log4j configuration level error -


my log4j configuration follows

log4j.rootlogger=info, ca, fa, da  #console appender log4j.appender.ca=org.apache.log4j.consoleappender log4j.appender.ca.layout=org.apache.log4j.patternlayout log4j.appender.ca.layout.conversionpattern=%-4r [%t] %-5p %c %x - %m%n  #file appender log4j.appender.fa=org.apache.log4j.fileappender log4j.appender.fa.file=/home/admin/logs/sysout.log log4j.appender.fa.layout=org.apache.log4j.patternlayout log4j.appender.fa.layout.conversionpattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.fa.threshold = warn    #file appender 2 log4j.appender.da=org.apache.log4j.fileappender log4j.appender.da.file=/home/admin/logs/debug.log log4j.appender.da.layout=org.apache.log4j.patternlayout log4j.appender.da.layout.conversionpattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.da.threshold = trace 

my understading

  1. info logged console
  2. warn logged sysout.log
  3. trace logged debug.log

but warn getting logged both debug.log , sysout.log. trace not logging in of file.

console having trace , warn both.

can please tell me doing wrong

you need separate logger , appender concepts in mind.

for 3 appenders, remember threshold lowest level of message appender process. appender process messages @ threshold level or higher level.

ca has no threshold set, log messages sent regardless of level. da has threshold of trace log sent (since trace lowest level). fa has threshold of warn filter out messages @ levels below warn - contain warn, error , fatal messages.

the important part of previous paragraph "all messages that sent it". since have configured root logger level of info , have not configured specific loggers lower level, messages @ info , above sent appenders - debug , trace messages silently dropped. why see no trace output in of loggers.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -