cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Log4j not writing to file

BrianKrieger
7-Bedrock

Log4j not writing to file

OK, I need a forehead slap, I'm sure. Does running a publish scheduler only allow writing to the background method server log? I was sure we had been using log4j with an external log file but apparently it hasn't been running. Manually using a java logger definitely only goes to the BGMS log file. Am I going crazy here? I was thinking we could specify multiple loggers (for applications) to write to multiple files, but maybe I'm just crazy......

When I try it now, even the windchill shell version isn't writing to the log file. Which it did before. At least that I remember. It's reading the log4j properties and seems to be initializing fine. Log file is created/locked as necessary.

Can anyone lend help in the palm to forehead moment I appear to be needing?

WC 10.1 M020

Thank you,
Brian Krieger
[75th]

Logger class:
public class Logger4j {

private static boolean isInitialized = false;
protected Logger4j() {}

public static Logger getLogger(Class class1) {
if(!isInitialized) {
PropertyConfigurator.configure(PropertyHandler.getPath("LOG4J_PROPERTY_FILE"));
isInitialized = true;
}
Logger logger = Logger.getLogger(class1);
return logger;
}
}

Test class just to log:

import na.paccar.engineering.efolders.util.Logger4j;
import na.paccar.engineering.efolders.util.StartScriptLogger;

import org.apache.log4j.Logger;

public class LogTest {
public static Logger logger = Logger4j.getLogger(LogTest.class);
public static java.util.logging.Logger manualLogger = StartScriptLogger.getStartUpLogger();

public static void main(String[] args){
logger.debug("Message Thrown");
System.out.println("System out message");
manualLogger.info("Info Message Manual Logger");
}

}

Yields the following from a windchill shell:

[cid:image002.png@01CF848D.36795450]
2 REPLIES 2

Hi,

Did you check the logger level? You can get or set the log level from
following location

Customization-->tools->log4J

set the logger level to all

Best Regards
Prajeesh Kumar


On Tue, Jun 10, 2014 at 7:50 PM, Brian Krieger <->
wrote:

> OK, I need a forehead slap, I’m sure. Does running a publish scheduler
> only allow writing to the background method server log? I was sure we had
> been using log4j with an external log file but apparently it hasn’t been
> running. Manually using a java logger definitely only goes to the BGMS log
> file. Am I going crazy here? I was thinking we could specify multiple
> loggers (for applications) to write to multiple files, but maybe I’m just
> crazy……
>
>
>
> When I try it now, even the windchill shell version isn’t writing to the
> log file. Which it did before. At least that I remember. It’s reading
> the log4j properties and seems to be initializing fine. Log file is
> created/locked as necessary.
>
>
>
> Can anyone lend help in the palm to forehead moment I appear to be needing?
>
>
>
> WC 10.1 M020
>
>
>
> Thank you,
>
> Brian Krieger
>
> [image: 75th]
>
>
>
> Logger class:
>
> *public* *class* Logger4j {
>
>
>
> *private* *static* *boolean* *isInitialized* = *false*;
>
> *protected* Logger4j() {}
>
>
>
> *public* *static* Logger getLogger(*Class* class1) {
>
> *if*(!*isInitialized*) {
>
> PropertyConfigurator.*configure*(PropertyHandler.
> *getPath*("LOG4J_PROPERTY_FILE"));
>
> *isInitialized* = *true*;
>
> }
>
> Logger logger = Logger.*getLogger*(class1);
>
> *return* logger;
>
> }
>
> }
>
>
>
> Test class just to log:
>
>
>
> *import* na.paccar.engineering.efolders.util.Logger4j;
>
> *import* na.paccar.engineering.efolders.util.StartScriptLogger;
>
>
>
> *import* org.apache.log4j.Logger;
>
>
>
> *public* *class* LogTest {
>
> *public* *static* Logger *logger* = Logger4j.*getLogger*(LogTest.
> *class*);
>
> *public* *static* java.util.logging.Logger *manualLogger* =
> StartScriptLogger.*getStartUpLogger*();
>
>
>
> *public* *static* *void* main(String[] args){
>
> *logger*.debug("Message Thrown");
>
> System.*out*.println("System out message");
>
> *manualLogger*.info("Info Message Manual Logger");
>
> }
>
>
>
> }
>
>
>
> Yields the following from a windchill shell:
>
>
>
>

Hi Brian,


The answer is no. The publisher scheduler places a queued entries into the schedule queues and then the publishing queues. Like most publishing, the backround method servers hands the queues then when the CAD worker is initiated, foreground handles the WCADMIN user publishing just like a normal CAD user with temporary workspaces. Its hard filtering the foregrounds because they are used by other actual CAD users. This is why I mentioned a pseudo cluster with a side set of foreground method server slaves handling your publishing and replication schedules to separate the load from your actual client foreground method servers.


Thenyou can place verbosities on the fly on the slaveswithout affecting theuser method servers.


What's the problem in the first place that you need verbosities. Sometimes, I seen on Windows OS's that the CAD agent logs get locked. So the best thing to do, is to archive, delete them on a restart of Windchill. You can alsoUnixtrim them.


Try having multipleworkers on a single machine and publish based on lifecycle workflow states.


Good luck,



Patrick




In Reply to Brian Krieger:


OK, I need a forehead slap, I'm sure. Does running a publish scheduler only allow writing to the background method server log? I was sure we had been using log4j with an external log file but apparently it hasn't been running. Manually using a java logger definitely only goes to the BGMS log file. Am I going crazy here? I was thinking we could specify multiple loggers (for applications) to write to multiple files, but maybe I'm just crazy......

When I try it now, even the windchill shell version isn't writing to the log file. Which it did before. At least that I remember. It's reading the log4j properties and seems to be initializing fine. Log file is created/locked as necessary.

Can anyone lend help in the palm to forehead moment I appear to be needing?

WC 10.1 M020

Thank you,
Brian Krieger
[75th]

Logger class:
public class Logger4j {

private static boolean isInitialized = false;
protected Logger4j() {}

public static Logger getLogger(Class class1) {
if(!isInitialized) {
PropertyConfigurator.configure(PropertyHandler.getPath("LOG4J_PROPERTY_FILE"));
isInitialized = true;
}
Logger logger = Logger.getLogger(class1);
return logger;
}
}

Test class just to log:

import na.paccar.engineering.efolders.util.Logger4j;
import na.paccar.engineering.efolders.util.StartScriptLogger;

import org.apache.log4j.Logger;

public class LogTest {
public static Logger logger = Logger4j.getLogger(LogTest.class);
public static java.util.logging.Logger manualLogger = StartScriptLogger.getStartUpLogger();

public static void main(String[] args){
logger.debug("Message Thrown");
System.out.println("System out message");
manualLogger.info("Info Message Manual Logger");
}

}

Yields the following from a windchill shell:

[cid:image002.png@01CF848D.36795450]
Top Tags