0
如何爲所有級別的log4j
輸出添加一個唯一ID(以跟蹤哪些請求屬於多線程機器)?log4j在所有記錄的消息前的唯一ID?
log4j.appender.console.layout.ConversionPattern = ???
如何爲所有級別的log4j
輸出添加一個唯一ID(以跟蹤哪些請求屬於多線程機器)?log4j在所有記錄的消息前的唯一ID?
log4j.appender.console.layout.ConversionPattern = ???
在一個多線程的機器,你應該使用線程ID /線程名稱的跟蹤日誌。
從log4j的文檔,
For example, the PatternLayout with the conversion pattern "%r [%t] %-5p %c - %m%n"
will output something akin to:
176 [main] INFO org.foo.Bar - Located nearest gas station.
閱讀here如果你需要轉換模式的更多想法。