Thanks Ben.
My application is NOT a web-application. I don't have any web.xml file. Also, as of now, i'm just testing the spring application using JUnit tests.
In this case, i added the log4j.properties file, added the log4j.jar file in the class path.
Code:
# 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=DEBUG stdout, 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.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=/irmt/src/META-INF/irmt.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
I also wrote the following code in my JUnit test to write the log.
Code:
public class ProjectTests extends AbstractRMTTests {
private static Log logger = LogFactory.getLog(ProjectTests.class);
....
...
public void testMethod1 {
logger.debug("testmessage");
...
}
}
But i DON'T know how to enable this log as you mentioned for this kind of stand-alone application.
Could you please let me know how to do this?
Thanks!