Remove Thread and category column in log4j html log

痞子三分冷 提交于 2019-12-13 03:53:24

问题


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


来源:https://stackoverflow.com/questions/6923247/remove-thread-and-category-column-in-log4j-html-log

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!