[slf4j-user] SLF4J w/Log4J and Axis2 - No Log File is created

Ceki Gulcu ceki at qos.ch
Tue Sep 15 22:13:32 CEST 2009


Hello Scott,

 From what you write, it looks like you are using the JDK binding 
(slf4j-jdk14.jar) instead of log4j (slf4j-log4j12.jar). See also 
http://slf4j.org/manual.html

Scott Selvia wrote:
> I have changed my code from Log4J logging to SLF4J and I now my log 
> files are no longer written to disk for my web service, I can see all of 
> the logging in the tomcat console.  I copied the following slf4j jars to 
> my apache-tomcat-6.0.20\webapps\axis2\WEB-INF\lib folder and I renamed 
> the existing slf4j-api-1.5.2.jar.org and slf4j-jdk14-1.5.2.jar.org. 
>  Inside the apache-tomcat-6.0.20\webapps\axis2\WEB-INF\classes folder 
> the commons-logging.properties has the following:
> 
> # Uncomment the next line to disable all logging.
> #org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
> 
> # Uncomment the next line to enable the simple log based logging
> #org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
> 
> # Uncomment the next line to enable log4j based logging
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
> 
> Also, the log4j.properties has:
> 
> # Set root category priority to INFO and its only appender to CONSOLE.
> log4j.rootCategory=INFO, CONSOLE
> #log4j.rootCategory=INFO, CONSOLE, LOGFILE
> log4j.category.com.myservice=TRACE, MyWebService
> 
> # Set the enterprise logger priority to FATAL
> log4j.logger.org.apache.axis2.enterprise=FATAL
> log4j.logger.de.hunsicker.jalopy.io=FATAL
> log4j.logger.httpclient.wire.header=FATAL
> log4j.logger.org.apache.commons.httpclient=FATAL
> 
> # CONSOLE is set to be a ConsoleAppender using a PatternLayout.
> log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
> log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
> log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %m%n
> 
> # LOGFILE is set to be a File appender using a PatternLayout.
> log4j.appender.LOGFILE=org.apache.log4j.FileAppender
> log4j.appender.LOGFILE.File=axis2.log
> log4j.appender.LOGFILE.Append=true
> log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
> log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
> 
> # My Web Service Appender
> 
> log4j.appender.MyWebService=org.apache.log4j.RollingFileAppender
> log4j.appender.file.maxFileSize=100KB
> log4j.appender.file.maxBackupIndex=5
> log4j.appender.MyWebService.File=../../logs/MyWebService.log
> log4j.appender.MyWebService.layout=org.apache.log4j.PatternLayout
> log4j.appender.MyWebService.layout.ConversionPattern=%d [%t] %-5p %c %x 
> - %m%n
> 
> Does SLF4J ignore the logging properties file?  How do I get a log file 
> written to disk with SLF4J?


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list