Log4J applications:
public class LogUtility
{
public static Logger getLogger(Class clazz)
{
System.setProperty("logFileName", name + ".log");
return Logger.getLogger(clazz.getName());
}
}
public class LogUtility
{
public static Logger getLogger(Class clazz)
{
System.setProperty("logFileName", name + ".log");
return Logger.getLogger(clazz.getName());
}
}
log4j.properties:
log4j.rootLogger=DEBUG,CONSOLE,FILE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.conversionPattern=%m%n
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=${logFileName}
#log4j.appender.FILE.MaxFileSize=512KB
#log4j.appender.FILE.MaxBackupIndex=3
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p - %m%n