25 March 2011

log4j.properties log to file example

log4j.appender.save2file=org.apache.log4j.FileAppender
log4j.appender.save2file.layout=org.apache.log4j.PatternLayout
log4j.appender.save2file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.save2file.File=c:\\newsEditor.log


in line  log4j.rootLogger=debug , save2file
debug you can replace to any log4j levels
 save2file is name of appender which you can change to any.