log4j.debug=true
as the first line in my log4j.properties and here is the log4j output in catalina.out. The log4j.properties is at the bottom of this mail.
---------------------------
INFO: Reloading this Context has started
log4j: Parsing for [root] with value=[debug, all].
log4j: Level token is [debug].
log4j: Category root set to DEBUG
log4j: Parsing appender named "all".
log4j: Parsing layout options for "all".
log4j: Setting property [locationInfo] to [true].
log4j: Setting property [title] to ['All' Log].
log4j: End of parsing for "all".
log4j: Setting property [immediateFlush] to [true].
log4j: Setting property [file] to [/usr/local/tomcat/webapps/singlemote/logs/all.html].
log4j: Setting property [append] to [false].
log4j: setFile called: /usr/local/tomcat/webapps/singlemote/logs/all.html, false
log4j: setFile ended
log4j: Parsed "all" options.
*** parsed all, now it goes to logger singlemote
log4j: Parsing for [singlemote] with value=[DEBUG, singlemote].
log4j: Level token is [DEBUG].
log4j: Category singlemote set to DEBUG
log4j: Parsing appender named "singlemote".
log4j: Parsing layout options for "singlemote".
log4j: Setting property [title] to ['Singlemote' Log].
log4j: Setting property [locationInfo] to [true].
log4j: End of parsing for "singlemote".
log4j: Setting property [immediateFlush] to [true].
log4j: Setting property [append] to [false].
log4j: Setting property [file] to [/usr/local/tomcat/webapps/singlemote/logs/singlemote.html].
log4j: setFile called: /usr/local/tomcat/webapps/singlemote/logs/singlemote.html, false
log4j: setFile ended
log4j: Parsed "singlemote" options.
log4j: Handling log4j.additivity.singlemote=[null]
***
log4j: Parsing for [singlemote.dao] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category singlemote.dao set to DEBUG
log4j: Handling log4j.additivity.singlemote.dao=[null]
log4j: Parsing for [singlemote.bean] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category singlemote.bean set to DEBUG
log4j: Handling log4j.additivity.singlemote.bean=[null]
**** skipped over HibUtil, parses only two categories of Hibernate
log4j: Parsing for [net.sf.hibernate.SQL] with value=[debug].
log4j: Level token is [debug].
log4j: Category net.sf.hibernate.SQL set to DEBUG
log4j: Handling log4j.additivity.net.sf.hibernate.SQL=[null]
log4j: Parsing for [net.sf.hibernate.cache] with value=[debug].
log4j: Level token is [debug].
log4j: Category net.sf.hibernate.cache set to DEBUG
log4j: Handling log4j.additivity.net.sf.hibernate.cache=[null]
log4j: Parsing for [org.apache.struts] with value=[debug, struts].
log4j: Level token is [debug].
**** goes to category struts and appender struts now
log4j: Category org.apache.struts set to DEBUG
log4j: Parsing appender named "struts".
log4j: Parsing layout options for "struts".
log4j: Setting property [title] to ['Struts' Log].
log4j: Setting property [locationInfo] to [true].
log4j: End of parsing for "struts".
log4j: Setting property [immediateFlush] to [true].
log4j: Setting property [file] to [/usr/local/tomcat/webapps/singlemote/logs/struts.html].
log4j: Setting property [append] to [false].
log4j: setFile called: /usr/local/tomcat/webapps/singlemote/logs/struts.html, false
log4j: setFile ended
log4j: Parsed "struts" options.
log4j: Handling log4j.additivity.org.apache.struts=[null]
****** comes back for another Hibernate class
log4j: Parsing for [net.sf.hibernate.tool.hbm2ddl] with value=[debug].
log4j: Level token is [debug].
log4j: Category net.sf.hibernate.tool.hbm2ddl set to DEBUG
log4j: Handling log4j.additivity.net.sf.hibernate.tool.hbm2ddl=[null]
*** parses the root Hibernate class, and its appender hib2
log4j: Parsing for [net.sf.hibernate] with value=[debug, hib2].
log4j: Level token is [debug].
log4j: Category net.sf.hibernate set to DEBUG
log4j: Parsing appender named "hib2".
log4j: Parsing layout options for "hib2".
log4j: Setting property [locationInfo] to [true].
log4j: Setting property [title] to ['Hibernate' Log].
log4j: End of parsing for "hib2".
log4j: Setting property [immediateFlush] to [true].
log4j: Setting property [append] to [false].
log4j: Setting property [file] to [/usr/local/tomcat/webapps/singlemote/logs/hibernate.html].
log4j: setFile called: /usr/local/tomcat/webapps/singlemote/logs/hibernate.html, false
log4j: setFile ended
log4j: Parsed "hib2" options.
log4j: Handling log4j.additivity.net.sf.hibernate=[null]
*** goes up to logger HibUtil and its appender hib
log4j: Parsing for [singlemote.hibutil] with value=[DEBUG, hib].
log4j: Level token is [DEBUG].
log4j: Category singlemote.hibutil set to DEBUG
log4j: Parsing appender named "hib".
log4j: Parsing layout options for "hib".
log4j: Setting property [title] to ['Hibernate Util' Log].
log4j: Setting property [locationInfo] to [true].
log4j: End of parsing for "hib".
log4j: Setting property [immediateFlush] to [true].
log4j: Setting property [file] to [/usr/local/tomcat/webapps/singlemote/logs/HibUtil.html].
log4j: Setting property [append] to [false].
log4j: setFile called: /usr/local/tomcat/webapps/singlemote/logs/HibUtil.html, false
log4j: setFile ended
log4j: Parsed "hib" options.
log4j: Handling log4j.additivity.singlemote.hibutil=[null]
*** goes back for the couple of Hibernate categories that it left out
log4j: Parsing for [net.sf.hibernate.type] with value=[debug].
log4j: Level token is [debug].
log4j: Category net.sf.hibernate.type set to DEBUG
log4j: Handling log4j.additivity.net.sf.hibernate.type=[null]
log4j: Parsing for [net.sf.hibernate.connection.DriverManagerConnectionProvider] with value=[trace, hib2].
log4j: Level token is [trace].
log4j: Category net.sf.hibernate.connection.DriverManagerConnectionProvider set to DEBUG
*** tries to parse hib2 again
log4j: Parsing appender named "hib2".
log4j: Appender "hib2" was already parsed.
log4j: Handling log4j.additivity.net.sf.hibernate.connection.DriverManagerConnectionProvider=[null]
log4j: Finished configuring.
-----------------------------------------
As you can see, log4j is jumping all over the place. I've marked sections with *s and a message above. Is this normal behavior (like a stack storage or something)?
I am going to read the docs yet again, but if you know whats going on here, plz let me know.
Thanks Karan
Joe Germuska wrote:
At 9:49 AM -0600 2/9/05, Karan wrote:
Any help is greatly appreciated.
I suggest starting by specifying the "log4j.debug" system property when you launch startup. You can often find out exactly what's going wrong with that.
Joe
-- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
.
Hi,
I am running TC + Hib + Struts. I have log4j.jar in the classpath. The following is the log4j.properties of my web application. The files struts.html and hibernate.html are created automatically everytime TC reads log4j.properties. However, nothing is ever written into them. I have log4j.jar in both my_application/WEB-INF/lib and in tomcat/common/lib. I do not have commons-logging in both the lib paths.
------------------------------------------------------------------ log4j.rootLogger=debug, all
log4j.appender.all=org.apache.log4j.FileAppender
log4j.appender.all.layout=org.apache.log4j.HTMLLayout
log4j.appender.all.layout.LocationInfo=true
log4j.appender.all.layout.Title='All' Log
log4j.appender.all.File=/usr/local/tomcat/webapps/singlemote/logs/all.html
log4j.appender.all.ImmediateFlush=true log4j.appender.all.Append=false
######################### COMPLETE LOGGING #######################
log4j.logger.singlemote=DEBUG, singlemote
log4j.logger.singlemote.bean=DEBUG
log4j.logger.singlemote.dao=DEBUG
log4j.appender.singlemote=org.apache.log4j.FileAppender
log4j.appender.singlemote.layout=org.apache.log4j.HTMLLayout
log4j.appender.singlemote.layout.LocationInfo=true
log4j.appender.singlemote.layout.Title='Singlemote' Log
log4j.appender.singlemote.File=/usr/local/tomcat/webapps/singlemote/logs/singlemote.html
log4j.appender.singlemote.ImmediateFlush=true log4j.appender.singlemote.Append=false
######################## HIBERNATE-UTIL LOGGING
##################################
log4j.logger.singlemote.hibutil=DEBUG, hib
log4j.appender.hib=org.apache.log4j.FileAppender
log4j.appender.hib.layout=org.apache.log4j.HTMLLayout
log4j.appender.hib.layout.LocationInfo=true
log4j.appender.hib.layout.Title='Hibernate Util' Log
log4j.appender.hib.File=/usr/local/tomcat/webapps/singlemote/logs/HibUtil.html
log4j.appender.hib.ImmediateFlush=true log4j.appender.hib.Append=false
######################## HIBERNATE LOGGING ################################## log4j.logger.net.sf.hibernate=debug, hib2
### log just the SQL
log4j.logger.net.sf.hibernate.SQL=debug
### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=debug
### log schema export/update ###
log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug
### log cache activity ###
log4j.logger.net.sf.hibernate.cache=debug
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace,
hib2
log4j.appender.hib2=org.apache.log4j.FileAppender
log4j.appender.hib2.File=/usr/local/tomcat/webapps/singlemote/logs/hibernate.html
log4j.appender.hib2.ImmediateFlush=true log4j.appender.hib2.Append=false log4j.appender.hib2.layout=org.apache.log4j.HTMLLayout log4j.appender.hib2.layout.LocationInfo=true log4j.appender.hib2.layout.Title='Hibernate' Log
############################## STRUTS LOGGING #################################### log4j.logger.org.apache.struts=debug, struts
log4j.appender.struts=org.apache.log4j.FileAppender
log4j.appender.struts.File=/usr/local/tomcat/webapps/singlemote/logs/struts.html
log4j.appender.struts.ImmediateFlush=true log4j.appender.struts.Append=false log4j.appender.struts.layout=org.apache.log4j.HTMLLayout log4j.appender.struts.layout.LocationInfo=true log4j.appender.struts.layout.Title='Struts' Log ------------------------------------------------------------------------
I did make struts and hib2 part of the rootLogger, but then all messages are stored in the struts.html and hibernate.html (basically they become copies of all.html). Moreover, the reason I'm implementing logging in this manner is because I want to seperate the logging of different layers of my application. In beans: -- goes to singlemote.html private static Logger log = Logger.getLogger("singlemote.bean"); In DAOs: -- goes to singlemote.html private static Logger log = Logger.getLogger("singlemote.dao"); In HibernateUtil.java: -- goes to HibUtil.html private static Logger log = Logger.getLogger("singlemote.hibutil");
Any help is greatly appreciated.
Also, Off-topic: how do I make log4j pick up $catalina_home from the env and use that to specify the destination path for the generated log files.
Thanks,
Karan
--
CM II
Resolution Systems Inc.
/-- never compromise. what if you compromise and lose? --/
//
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]