How to log multiple threads in different log files?

前端 未结 6 662
南旧
南旧 2020-12-05 12:40

I have a JAVA class that starts various threads that have unique IDs. Each thread should log into a unique log file, named after the ID.log.

Because I only get the u

6条回答
  •  伪装坚强ぢ
    2020-12-05 13:03

    Logback has a special appender called SiftingAppender which provides a very nice solution to the type of problems you describe. A SiftingAppender can be used to separate (or sift) logging according to any runtime attribute, including thread id.

提交回复
热议问题