开发者

Log4j - log file

开发者 https://www.devze.com 2023-03-22 09:04 出处:网络
Does anybody knows how apache log4j handling with s开发者_运维技巧treams ? If it open and close log file for each line or if it simply let open stream and flushing it ?One thing springs to mind. If

Does anybody knows how apache log4j handling with s开发者_运维技巧treams ?

If it open and close log file for each line or if it simply let open stream and flushing it ?


One thing springs to mind. If log4j keeps the log file open, log rollover fails, because its file handle still points to the old log file. Opening, writing and closing means log4j would correctly grab the file handle for the new log file.


It doesn't open and close the log file for each line (this would cause too much overhead). Output can be buffered (check the documentation). You could create a custom appender that opens the file for appending for every line though, but what are you trying to accomplish?

0

精彩评论

暂无评论...
验证码 换一张
取 消