views:

38

answers:

1

Hello everyone,

I am using log4j as logging framework in my application and JBOSS 5 as Application server. I have created a log4j.properties file in the src folder of the application. That's how my log4j.properties looks like:

#Default log level to ERROR. Other levels are INFO and DEBUG.
log4j.rootLogger=INFO, ROOT
log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
##Uncomment the next line and comment the 2nd next line when ready to deploy
log4j.appender.ROOT.File=/www/public/logs/myapp.log
##log4j.appender.ROOT.File=C:/myapp.log
log4j.appender.ROOT.MaxFileSize=100KB
#Keep 5 old files around.
log4j.appender.ROOT.MaxBackupIndex=5
log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
#Format almost same as WebSphere's common log format.
log4j.appender.ROOT.layout.ConversionPattern=[%d] %t %c %-5p - %m%n

#Optionally override log level of individual packages or classes
log4j.logger.com.webage.ejbs=INFO

But I can see that the myapp.log is never been created so I am not able to see any logs. Also I can server.log file in the sever logs folder but it has so much verbose that it's hard to track what's going on there. So I have two questions:
1. Why myapp.log is not being created.
2. Do u think the log4j.property file shown above is sufficient or not need to configure more stuff here.

Thanks,
Sameer

A: 

Most likely your log4j.properties is not getting picked up.

To configure log4j in Jboss 5 you would edit the file at

server/default/conf/jboss-log4j.xml

If you still want to use log4j.propeties, In the webapp, it should be placed in in your deploy/myapp.war/WEB-INF/classes

Follow the detailed instuctions at section "10.3.7. Using your own log4j.properties file - class loader scoping" in this link

JoseK