【问题标题】:Messy logs in multi - threaded java application using log4j使用 log4j 的多线程 java 应用程序中的凌乱日志
【发布时间】:2020-02-01 03:52:05
【问题描述】:

我已为多线程应用程序启用 log4j 日志记录,这使得日志文件难以分析。

日志文件看起来像

2019-10-02 07:49:55:DEBUG  :Main: Start of the call
2019-10-02 07:49:55:DEBUG  :pool-1-thread-4: Running in pool-1-thread-4
2019-10-02 07:49:55:DEBUG  :pool-1-thread-2: Running in pool-1-thread-2
2019-10-02 07:49:55:DEBUG  :pool-1-thread-4: Running in pool-1-thread-4

我们可以在记录时或至少在解析日志文件后根据线程 ID 对日志进行分组吗?

【问题讨论】:

    标签: java multithreading logging log4j


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-29
      • 2019-06-14
      • 2017-06-26
      • 2016-09-28
      相关资源
      最近更新 更多