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]