How to ues log4j to send log email in the multithreaded processes as similiar with single-threaded# Java - 爪哇娇娃
l*b
1 楼
My current system is single-threaded with several modules which are
processed in sequence. I use SMTPAppender to capture error and send warning
emails with the following format:
[time][thread-1][module 1]start: XXXXXXX
[time][thread-1][module 2]XXXXXXX
[time][thread-1][module 3]XXXXXXX
[time][thread-1][module 4]ERR: XXXXXXX
After I change the system to multhithreaded, the logs will be tangled up
like:
[time][thread-1][module 1]start: XXXXXXX
[time][thread-2][module 1]start: XXXXXXX
[time][thread
processed in sequence. I use SMTPAppender to capture error and send warning
emails with the following format:
[time][thread-1][module 1]start: XXXXXXX
[time][thread-1][module 2]XXXXXXX
[time][thread-1][module 3]XXXXXXX
[time][thread-1][module 4]ERR: XXXXXXX
After I change the system to multhithreaded, the logs will be tangled up
like:
[time][thread-1][module 1]start: XXXXXXX
[time][thread-2][module 1]start: XXXXXXX
[time][thread