我有以下appender布局:
log4j.appender.console.layout.ConversionPattern=%d{MM/dd/yyy HH:mm:ss} level='%-5p' node='%X{node}' channel='statistic' thread='%t' \
message='%m%n '
在控制台中我看到以下内容:
03/31/16 14:38:49 level='INFO ' node='' channel='statistic' thread='Scanner-2' message='Root WebApplicationContext: initialization started
'03/31/16 14:38:50 level='DEBUG' node='' channel='statistic' thread='Scanner-2' message='Adding [servletConfigInitParams] PropertySource with lowest search precedence
'03/31/16 14:38:50 level='DEBUG' node='' channel='statistic' thread='Scanner-2' message='Adding [servletContextInitParams] PropertySource with lowest search precedence
....
我想避免新行以单引号开头。这句话应放在上一行。
我怎样才能实现它?
答案 0 :(得分:2)
邮件格式正在使用新的行appender,但之后是你附加单个quoute ... 改为使用:
log4j.appender.console.layout.ConversionPattern=%d{MM/dd/yyy HH:mm:ss} level='%-5p' node='%X{node}' channel='statistic' thread='%t' \
message='%m'%n
答案 1 :(得分:1)
如果您真的需要单引号,只需将消息模式更改为%m%n ,或者可能'%m'%n