-
Hi everyone, I have been stuck on this problem for a while now. I have managed to replicate that issue with next code. (disregard method names sync and async that was left from old testing) My configuration looks like this I have tried adding immediateFlush="true", BufferedIO=false, and it makes no difference in behavior, I know that logging is synchronous but it was worth a try. Log in windows explorer while app is running Notice: I have noticed that if I change my configuration, so both appenders write inside same folder this issue disappears, in this use case, but in other project where I have 4-5 appenders and they all write to same folder but different files I still have this issue, so the problem is really inconsistent, I think this might be something related to windows/file explorer/log4j2 in combination, but cant put my finger on the problem. I have seen this stack overflow post, but it is 9 years old and it still doesnt give definitive answer: https://stackoverflow.com/questions/26676331/log4j-rollingfileappender-not-writing-to-log-until-application-close |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
Could you look at this? Can it be explained somehow by Windows strange file locking semantics? Maybe the file has an exclusive lock until the JVM releases it? |
Beta Was this translation helpful? Give feedback.
-
Could be related to #2025 for the |
Beta Was this translation helpful? Give feedback.
-
If I understand it correctly the problem is:
If that is the case, it is more a limitation of Windows Explorer than anything else: it does not refresh the file list. |
Beta Was this translation helpful? Give feedback.
-
I have also encountered such a problem, very confused. Windows files will not be updated unless you right-click to view file properties. |
Beta Was this translation helpful? Give feedback.
-
Use the force method,the file be updated in real time. But affects performance. |
Beta Was this translation helpful? Give feedback.
-
As I understood from this article this problem is NTFS problem and not Log4j2 problem,. (link: https://devblogs.microsoft.com/oldnewthing/20111226-00/?p=8813) |
Beta Was this translation helpful? Give feedback.
As I understood from this article this problem is NTFS problem and not Log4j2 problem,. (link: https://devblogs.microsoft.com/oldnewthing/20111226-00/?p=8813)