Best practices for Java logging from multiple threads?

前端 未结 12 1217
星月不相逢
星月不相逢 2020-12-03 02:39

I want to have a diagnostic log that is produced by several tasks managing data. These tasks may be in multiple threads. Each task needs to write an element (possibly with s

12条回答
  •  攒了一身酷
    2020-12-03 03:26

    I tend to use SLF4J on top of Log4J. The parameterized logging functionality is especially attractive if you are going to have a lot of logging statements that may well get switched off in a production environment.

    It can also run over the top of java.util.logging or use it's own simple output.

提交回复
热议问题