stevebeech
asked on
Setting up Log4j in Websphere/Struts application
Hi,
I'm trying to enable log4j logging via commons-logging in a Struts application being developed in Websphere Studio - currently its just using SimpleLog - but cannot get it to log to a file.
I've created a commons-logging.properties file and a log4j.properties file, which I've placed under the JavaSource folder (i.e. they get moved to the web-inf/classes folder upon deployment). These are shown below:
commons-logging.properties :
org.apache.commons.logging .Log=org.a pache.comm ons.loggin g.impl.Log 4JLogger
log4j.properties:
log4j.rootLogger=DEBUG, rolling
log4j.appender.rolling=org .apache.lo g4j.Rollin gFileAppen der
log4j.appender.rolling.Fil e=output.l og
log4j.appender.rolling.Max FileSize=1 00KB
log4j.appender.rolling.Max BackupInde x=1
log4j.appender.rolling.lay out=org.ap ache.log4j .SimpleLay out
Can anyone tell me why the output file isn't being created? I suspect that the properties files aren't being found and so log4j is not being instantiated.
Cheers,
Steve
I'm trying to enable log4j logging via commons-logging in a Struts application being developed in Websphere Studio - currently its just using SimpleLog - but cannot get it to log to a file.
I've created a commons-logging.properties
commons-logging.properties
org.apache.commons.logging
log4j.properties:
log4j.rootLogger=DEBUG, rolling
log4j.appender.rolling=org
log4j.appender.rolling.Fil
log4j.appender.rolling.Max
log4j.appender.rolling.Max
log4j.appender.rolling.lay
Can anyone tell me why the output file isn't being created? I suspect that the properties files aren't being found and so log4j is not being instantiated.
Cheers,
Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried this but still couldn't get Websphere to take notice.
In the end, I removed the commons-logging and just used log4j alone, as per http://www.webagesolutions.com/knowledgebase/waskb/waskb004/index.html
Thanks anyway,
Steve