Below are some examples of conversion patterns.
%d [%t] %-5p %c:%L %x - %m%n
date [thread] p? class:line x? - message newline
Similar to the TTCC layout except that the relative time is right padded if less than 6 digits, thread name is right padded if less than 15 characters and truncated if longer and the category name is left padded if shorter than 30 characters and truncated if longer.
and the reference
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=ERROR, CONSOLE
# CONSOLE is set to be a ConsoleAppender.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
# CONSOLE uses PatternLayout.
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c:%L %x - %m%n
#log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c:%L - %m%n
# Print only messages of level WARN or above in the package com.foo.
log4j.logger.com.hibernate=ERROR
log4j.logger.org.apache.commons.httpclient=ERROR
log4j.logger.org.apache.axis=INFO
log4j.logger.com.brock=DEBUG
No comments:
Post a Comment