Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log4j did nothing under windows service mode.

Status
Not open for further replies.

jmlynn1

Technical User
Oct 4, 2004
1
CA
Help! I have a Windows Service program that invokes a Java program that works fine when run as service debug mode. But when run as Windows Service mode, the log4j statements seem to do nothing whereas the Jaava program run to completion. The following stmts are how I create the logger instance:

PropertyConfigurator.configure("C:\\pps\\bin\\Test3.properties");
_logger = Logger.getLogger(Test3.class.getName());

_logger.info("Test3 executed...");
_logger.debug("Test3 debug trapped...");
_logger.error("Test3 error trapped...");

The following is my log4j.properties:
log4j.rootLogger=DEBUG, A1, R

log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=C:/pps/bin/log/Test3.log
log4j.appender.R.MaxFileSize=1000KB
log4j.appender.R.MaxBackupIndex=5
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %p %t %c - %m%n


The following stmt is how I invoke the java program using Windows Create process API:

D:\J2SDK142\bin\java.exe -classpath d:\j2sdk142\jre\lib;c:\pps\bin;c:\pps\bin\lib\log4j128.jar Test3


The Windows service program was configured to use
the administrator id and password for this testing.

Any help is appreciated.

jml

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top