Reputation: 902
Does anybody knows how apache log4j handling with streams ?
If it open and close log file for each line or if it simply let open stream and flushing it ?
Upvotes: 1
Views: 780
Reputation: 506
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.
Upvotes: 2
Reputation: 5559
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?
Upvotes: 1