I'm pretty new with log4j. I want to display log messages with these infos: log timestamp, priority, fully qualified class name, the message, class name only. I try to display twice the CATEGORY, once with a ConversionPattern, and once with an other ConversionPattern. Here is the piece of my log4j.properties:
log4j.appender.JDBC2.layoutPartsDelimiter=#-#
log4j.appender.B1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n #-#%-4r [%t] %-5p %c{1} %x %m%n
Sadly it does not work. How can I show full qualified class name and class name only in the same log message? TIA.
Francesco
It was my mistake. As you can see in my precedent post, Delimiter and PatternLayout refer to different appenders. I change
log4j.appender.JDBC2.layoutPartsDelimiter=#-#
log4j.appender.B1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n #-#%-4r [%t] %-5p %c{1} %x %m%n
into this:
log4j.appender.B1.layoutPartsDelimiter=#-#
log4j.appender.B1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n #-#%-4r [%t] %-5p %c{1} %x %m%n
and everything works fine, when I use @LAYOUT:1@ I got the first ConversionPattern (left of delimiter #-#). When I use @LAYOUT:2@ I got the second pattern. Thank you.
Francesco