-
1. Re: per app logging
kavandesai Dec 13, 2011 1:37 AM (in response to herb)Hi herb,
If you have spring based application than the following logging configuration should generate application specific log in JBOSS AS 7.1.0 Beta without any changes in standalone.xml
# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!
# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.
log4j.rootLogger=INFO, logfile
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=${jboss.server.log.dir}/applicationname.log
log4j.appender.logfile.MaxFileSize=512KB
# Keep three backup files.
log4j.appender.logfile.MaxBackupIndex=3
# Pattern to output: date priority [category] - message
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.logger.org.springframework.samples.petclinic.aspects=DEBUG
log4j.appender.logfile.Threshold=INFO
log4j.logger.org.hibernate.SQL=INFO,logfile
log4j.additivity.org.hibernate.SQL=false
log4j.logger.org.hibernate.type=logfile
I have placed log4.properties inside /WEB-INF/classes, log4j and commons-logging inside /WEB-INF/lib.
It worked for me.
-
2. Re: per app logging
jamezp Dec 15, 2011 12:50 PM (in response to herb)Currently there is no real way to do application specific logging, though we are working on it. There has been some work done on it, but it needs to be merged with some other logging work before it can be pushed upstream.
-
3. Re: per app logging
herb Dec 16, 2011 10:10 AM (in response to kavandesai)Thank you for answering!
@Kavan:
It works for me for all classes and lib which are in WEB-INF/classes and WEB-INF/lib but not e.g. for jars which are in modules (e.g. hibernate, beanutils, ...). The loglines for these jars aren't put to the app specific logfile.
Is this stuff working in your environment?
Do you really use AS7? Or are you using AS6/5/4? (because there is "$JBOSS_HOME/server/default" in your sample, which doesn't exist in AS7).
Thanks,
herb
-
4. Re: per app logging
kavandesai Dec 17, 2011 12:15 AM (in response to herb)Yes I am using JBOSS AS 7.1.0 Beta.
"because there is "$JBOSS_HOME/server/default" in your sample, which doesn't exist in AS7"
the above line is commented . Besically I was using 'petclinic' open source spring application.
"It works for me for all classes and lib which are in WEB-INF/classes and WEB-INF/lib but not e.g. for jars which are in modules (e.g. hibernate, beanutils, ...). The loglines for these jars aren't put to the app specific logfile"
I can see hibernate statement as well in the same log file I have checked it by keep "show_hibernate_query" to true.
-
5. Re: per app logging
ozizka Sep 14, 2012 3:39 PM (in response to kavandesai)Done in https://issues.jboss.org/browse/AS7-514 .