posted 15 years ago
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-1][module 2]XXXXXXX
[time][thread-1][module 3]XXXXXXX
[time][thread-2][module 2]XXXXXXX
[time][thread-2][module 3]XXXXXXX
[time][thread-2][module 4]end: XXXXXXX
[time][thread-1][module 4]ERR: XXXXXXX
.....
Moreover, if the buffer size in SMTPAppender is set as small, some reference info about thread-1 will be filtered. Is there any way to format the log email in the multhithreaded processes as similiar with single-threaded? Customize the SMTPAppender?