0

I have a webapp that allows a user to change the logging in some part of the application to DEBUG.

Configurator.setLevel(logger, Level.DEBUG);

The user then performs an action that allows DEBUG messages to output to the log file. Most messages come in just fine, but a part of the trailing end of messages doesn't come in. It stops part way. I waited to see if it does update and it did not.

If the user performs the same action again, allowing a further batch of DEBUG message to output, I can see that the part of the output that was missing last time, is now present (identified by its timestamp).

How do I fix this issue and why is the end of a batch of DEBUG messages missing?

udeleng
  • 866
  • 2
  • 14
  • 20

1 Answers1

0

You should be able to fix this by adding the following to you Log4j.properties

log4j.appender.FILE.ImmediateFlush=true  

Note: The default for this value is true.

tune5ths
  • 676
  • 6
  • 18
  • That didn't seem to work. The partial message I see occurs only in the last line for that particular action the user execute in the UI. We're using log4j 2, but our XML config is still based on the old log4j syntax; however, everything besides this issue seems to be working fine. I added in . – udeleng Aug 06 '20 at 22:02
  • 1
    I changed my configuration file to use the new xml syntax and that seems to have resolved the issue. – udeleng Aug 07 '20 at 16:27