Unusual immediateFlush behaviour #3312
-
Disclaimer: I am not an expert in log4j, I am giving the fullest and best account possible of what I've tried. For the last 9 months I've been trying to keep up with the log4j version upgrades as and when they come out. I tried to upgrade from version < Hindsight is 20/20 but this turned out to be a bug that was fixed in a later version however, this was not known at the time. At the time I concluded that the
So assuming this was the new expected behaviour, I removed this attribute. This was a mistake. There are 2 plugins in my app:
This is probably why that package attribute has the values it has, as a result there are two We don't use maven (using bazel), so we're out of luck with the plugin concat. The result meant that there was no log output, this is because the log4j.core file wasn't being picked up, and the log4j logs show this was indeed a problem:
So I go back to the previously working version that picks up the core slf4j, but not the sentry plugin and I sit tight hoping for a fix in the form of log4j3. Fast forward to beta testing log4j3: So I understand that as part of log4j 3, you don't have to run a concatenating processor over the I found my If I set this flush attribute to true, then I get the 'normal' logging behaviour, but this will kill our performance. So as of right now, I think I can only be on log4j3 to enable plugins properly, so I can be without the package attribute in the file, but the immediateFlush seems to not be what it used to be. The behaviour I've seen would be best described as Sorry for the long background, but it's important to see how I got in this situation. So my question: Did something change with There are a lot of moving parts to log4j and this issue, and I have tried to nail things down the best I can so it would be nice if somebody could confirm the following:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
What does 45 minutes worth of logs mean in term of size? The
When you shade two Log4j Core 3 JARs, you still need to merge Personally I find shading a bad practice from a security point of view (it makes SCA analysis harder). There are other ways to create single-JAR applications that do not involve shading, see How do I create a single-JAR application containing Log4j Core. If shading is really important for you, we could consider merging #2887, so that you can merge two
The attribute should be ignored in Log4j Core 3. |
Beta Was this translation helpful? Give feedback.
The concept of batch appears only if you use asynchronous loggers or appenders, which rely on a queue/buffer ring of log events. Your application threads will fill the queue with events and an asynchronous thread will deliver them to the destination. The end of batch corresponds to the situation, when the asynchronous thread man…