Marc, What jar are you talking about? I have a similar problem. Got log4j working with my application based on spring running on tomcat 5.5.17 but have troubles to set up logging for Spring/Whatever is using commons logging in my log4j xml.
Searching on the net reveals that this might be tomcat/commons-logging problems, but following various suggestions didn't help me. I won't put here various configuration files as they are correct (working with my app./ log file gets created - appender for spring only, but no logging messages for spring goes into it nor to anywhere else). I have commons-logging-api.jar in $TOMCAT_HOME.bin (v 1.0.4) log4j.1.2.4.jar + commons-loggin.jar in WEB-INF/lib. No other log4j configuration/jars lying around neither is set in tomcats configs. I also tried it with spring's jpetstore sample application, but didn't work either. Does anybody have any idea? Or an idea how to try to discover the problem (no logging, no pointers)? Thanks a lot, Mirek On 5/22/07, Marc Rameder <[EMAIL PROTECTED]> wrote:
Sorry for spaming but solution is found! Jar file was corrupted. Thanks @ all marc -----Ursprüngliche Nachricht----- Von: Marc Rameder [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 22. Mai 2007 16:38 An: 'Tomcat Users List' Betreff: AW: AW: AW: logging log4j of my application First of all thanks for your help!!! But I didn't find a solution until now. After revising the source code if found the main problem. I am using commons logging and not log4j. By using log4j all works fine. import org.apache.log4j.Logger; import org.apache.log4j.BasicConfigurator; private static final Logger LOG = Logger.getLogger(User.class); However with commons logging it doesn't. import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; private static final Log LOG = LogFactory.getLog(User.class); May somebody have an idea to solve the problem at the bottom with this new aspect? Regards marc -----Ursprüngliche Nachricht----- Von: Rainer Jung [mailto:[EMAIL PROTECTED] Gesendet: Montag, 21. Mai 2007 16:59 An: Tomcat Users List Betreff: Re: AW: AW: logging log4j of my application Your config looks OK to me. Sometimes such a thing happens, if one starts the process unintended as root, who then owns the log file and after starting again as non-root, the process user can not write to the file... You can add "-Dlog4j.debug" to the startup options of your Tomcat. Then catalina.out will contain information about log4j parsing its config, like log4j: Using URL [file:.../conf/log4j.properties] for automatic log4j configuration. log4j: Reading configuration from URL file:.../conf/log4j.properties log4j: Parsing for [root] with value=[DEBUG,FILE]. ... log4j: End of parsing for "FILE". log4j: Setting property [file] to [/home/jung/.../logs/RPSSERVER.log]. log4j: setFile called: /home/jung/.../logs/RPSSERVER.log, true ... Maybe you will detect something strange in this output. Regards, Rainer Marc Rameder wrote: > The output of the log file should be information about hibernate, spring and > my development in the net.thefource package. > I have used this log4j.properties for a GUI application where it is working > fine and also by testing the server with JUnit all debug information are > displayed. > I am starting the tomcat with the startup.bat. Hence it is not a service. > > A example for the GUI application would be: > 14:07:25,500 () [INFO ] CollectionFactory (<clinit>) - JDK 1.4+ collections > available > > marc > > log4j.rootLogger=DEBUG,FILE > #ConsoleAppender > log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender > log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout > log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss,SSS} (%x) [%-5p] > %c{1} (%M) - %m%n > #FileAppender > log4j.appender.FILE=org.apache.log4j.FileAppender > log4j.appender.FILE.layout=org.apache.log4j.PatternLayout > log4j.appender.FILE.layout.ConversionPattern=%d{HH:mm:ss,SSS} (%x) [%-5p] > %c{1} (%M) - %m%n > log4j.appender.FILE.File=${catalina.home}/logs/RPSSERVER.log > log4j.appender.FILE.File.MaxFileSize=1MB > # Keep one backup file > log4j.appender.FileApp.MaxBackupIndex=1 > log4j.appender.FileApp.layout=org.apache.log4j.PatternLayout > log4j.appender.FileApp.layout.ConversionPattern=%d{HH:mm:ss,SSS} (%x) [%-5p] > %c{1} (%M) - %m%n > > log4j.logger.org.apache.catalina=WARN, CONSOLE > log4j.logger.org.apache.catalina.core=WARN, CONSOLE > log4j.logger.org.apache.catalina.session=WARN, CONSOLE > > log4j.logger.net.thefource=DEBUG ,CONSOLE > > log4j.logger.org.apache.commons=WARN, CONSOLE > log4j.logger.org.hibernate=INFO, CONSOLE > log4j.logger.org.hibernate.type=INFO, CONSOLE > log4j.logger.org.springframework=INFO, CONSOLE > > -----Ursprüngliche Nachricht----- > Von: Rainer Jung [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 21. Mai 2007 13:55 > An: Tomcat Users List > Betreff: Re: AW: logging log4j of my application > > All right, so we assume, there are no log4j things lying around in your > Tomcat apart from your webapp. Also please check, that the running > Tomcat process has no -Dlog4j.configuration in its commandline. > > It could be, that you have a servlet initialization, that configures > log4j via its API, but let's assume this is not the case. > > Then even without the context-param, the log4j.properties in your > WEB-INF/classes should be found as the default configuration. Maybe the > context-param is an indicator, that there is explicit log4j > initialization code in your webapp and you are not using autoconfiguration. > > In both cases we assume it really picks up the > WEB-INF/classes/log4j.properties. > > So if a file gets created but nothing gets logged into it, we should > have a look at the contents of the log4j.properties file. You should > post it. > > Also: which messages would you expect there? > > Regards, > > Rainer > > > Marc Rameder wrote: >> I deploy a war file with the following content. >> WEB-INF: >> classes: >> contains the log4j.properties file in the root directory. Only >> one exists. >> lib: >> contains the log4j-1.2.9.jar not in any other directory >> >> my web.xml contains >> >> <context-param> >> <param-name>log4jConfigLocation</param-name> >> <param-value>classpath:log4j.properties</param-value> >> </context-param> >> >> I hope that's the information you ask for! >> thanks >> marc >> >> -----Ursprüngliche Nachricht----- >> Von: Rainer Jung [mailto:[EMAIL PROTECTED] >> Gesendet: Montag, 21. Mai 2007 13:27 >> An: Tomcat Users List >> Betreff: Re: logging log4j of my application >> >> How do you deploy the log4j Jar? Which place? Several places? >> >> Where do you keep your log4j configuration file? One file, several ones? >> >> Which mechanism did you choose to publish the files to log4j? >> >> The questions concerning "several" always mean: are those things only in >> your webapp, or also added to the container installation? >> >> Depending on the answers, it's relatively easy (after understanding >> tomcat class loaders and log4j default configuration mechanisms) to >> explain, which config gets evaluated and why. >> >> Regards, >> >> Rainer >> >> Marc Rameder wrote: >>> Hi >>> >>> I have a problem with tomcat 5.5.20. My application uses log4j 1.2.9and > I >>> am sure that all my implementation is correct because I uses JUnit and > the >>> logging works fine with it. However, Tomcat loads my log4j.propertiesso >> the >>> configuration of the web.xml should be right. >>> I know that because the log file is created but it contains no entries. >>> Moreover my log4j.properties is used in other projects without tomcat and >>> works file. >>> >>> Is there a special configuration of the tomcat? >>> >>> Thanks >>> marc --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]