开发者

Log4j - log file

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜