Remove Thread and category column in log4j html lo

2019-09-15 03:36发布

问题:

i am generating html format log output using log4j, but i want to output only Time Level and Message Column in it. how to format it in properties file?? do we need any things to be coded also?? please help.

log4j.appender.HA=org.apache.log4j.FileAppender
log4j.appender.HA.File=c://Test_Log/Test_Log.html
log4j.appender.HA.layout=org.apache.log4j.HTMLLayout
log4j.appender.HA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

help me... thanks all

回答1:

HTML layout doesn't look like it has a ConversionPattern



回答2:

According to the documentation:

  • %c is the category
  • %t is the thread info

Remove those from your pattern:

log4j.appender.HA.layout.ConversionPattern=%-4r %-5p %x - %m%n