log4j对齐ConversionPattern

时间:2012-02-24 13:15:13

标签: log4j design-patterns alignment

是否可以在log4j中创建一个ConversionPattern

Some short Msg                    : [INFO] class date
Some very looooooooooooooong msg  : [INFO] class date

我基本上想要实现的是消息与左对齐,其余信息在n个字符后开始,因此其余信息很好地对齐而不是

Some short Msg : [INFO] class date
Some very looooooooooooooong msg : [INFO] class date

1 个答案:

答案 0 :(得分:3)

只需将-放在模式中:

%-50m   | [%p] %c{1} %d %n"/