I have a Java Application with this following log4j configuration properties, called log4j-DEV.properties:
################################################################ # Root logger option ############################################################### log4j.rootLogger=ALL, file,stdout ############################################################### ############################################################### # Logger response ############################################################### log4j.logger.response=ALL, proxyLog log4j.additivity.response=false ############################################################### ############################################################# # APPENDER ############################################################# # Direct log messages to a log file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=C:\\log\\application.log log4j.appender.file.Threshold = ALL log4j.appender.file.MaxFileSize=10MB log4j.appender.file.MaxBackupIndex=1 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Threshold = ALL log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n # Direct log messages to a log file log4j.appender.proxyLog=org.apache.log4j.RollingFileAppender log4j.appender.proxyLog.Threshold = ALL log4j.appender.proxyLog.File=C:\\log\\proxyLog.log log4j.appender.proxyLog.MaxFileSize=10MB log4j.appender.proxyLog.MaxBackupIndex=1 log4j.appender.proxyLog.layout=org.apache.log4j.PatternLayout log4j.appender.proxyLog.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n I use Tomcat as Application Server and I launch it with parameter -Dlog4j.configuration="log4j-DEV.properties"
When application starts, the file C:\log\application.log and C:\log\proxyLog.log are created but are empty although application writes log with instruction:
Log log = LogFactory.getLog(getClass()); log.info("Test log"); What is wrong?
Thanks all
Logger logger = null;logger = Logger.getRootLogger();logger.info("TEST");