Modifying buffer size on runtime
<[email protected]> Tue, 28 Jan 2025 19:12:23 +0100
| Newsgroups | gmane.comp.jakarta.log4j.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Piotr,
One more thing I've seen. Finally, I'm modifying directly in the =
log4j2.xml file the buffer size of one of my loggers. I have enabled the =
debug, the log4j2 xml file has a monitor interval of 30 seconds.
I start my application with a buffer of 8K. Then:
1. I programmatically change it to 16K while the app is running:
INFO: 2025-01-28T17:56:17.015816443Z main TRACE Configured node =
RollingRandomAccessFile Key[type: int; name: bufferSize; qualifierType: =
PluginBuilderAttribute]=3D16384
=09
I check the log4j2.xml file:
<RollingRandomAccessFile name=3D"ACCESS_LOG" =
fileName=3D"${sys:log.dir}vproxy_access" =
filePattern=3D"${sys:log.dir}vproxy_access.%d{yyyy-MM-dd}" =
append=3D"true" bufferedIo=3D"true" bufferSize=3D"16384" =
immediateFlush=3D"false">
=20
=20
2. Then I change it to 2K:
INFO: 2025-01-28T17:57:47.216638176Z =
Log4j2-TF-1-ConfigurationFileWatcher-6 TRACE Configured node =
RollingRandomAccessFile Key[type: int; name: bufferSize; qualifierType: =
PluginBuilderAttribute]=3D2048
=09
Check:
<RollingRandomAccessFile name=3D"ACCESS_LOG" =
fileName=3D"${sys:log.dir}vproxy_access" =
filePattern=3D"${sys:log.dir}vproxy_access.%d{yyyy-MM-dd}" =
append=3D"true" bufferedIo=3D"true" bufferSize=3D"2048" =
immediateFlush=3D"false">
=09
=09
The point is that, while I'm logging, the ratio of lines that are logged =
is always the same, with 2048 it should be continually logging and with =
16384 I should see pauses between two consecutive loggings. But not.
Then, if I restart the application, it works as expected.
So, is it possible that changing the buffer size for this =
'RollingRandomAccessFile' is not working on runtime?
Thanks,
Joan.