java - How to initialize the log4j system properly -
i'm getting 2 warnings.
log4j:warn no appenders found logger (com.org.resolver). log4j:warn please initialize log4j system properly.
how resolve it?
my java class name resolver.java
in java class i'm calling
private static log log = logfactory.getlog(resolver.class);
you need put log4j.properties or log4j.xml in classpath. so, create file name log4j.properties , replace content below:
# root logger option log4j.rootlogger=info, debug, stdout, file # redirect log messages console log4j.appender.stdout=org.apache.log4j.consoleappender 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 # redirect log messages log file, support file rolling. log4j.appender.file=org.apache.log4j.rollingfileappender #. represents current folder (usually project root folder) log4j.appender.file.file=./logging.log log4j.appender.file.maxfilesize=5mb log4j.appender.file.maxbackupindex=10 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
Comments
Post a Comment