-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
There are two recent updates to log4j2 code:
- apache/logging-log4j2@c97591b#diff-1b16ca866ce507eeff0d9dcf99062ca7
- apache/logging-log4j2@a1918c2#diff-1b16ca866ce507eeff0d9dcf99062ca7
which improved the logging for log4j in case a file cannot be accessed while traversing a directory. Case in question relevant for Elasticsearch: a rollover strategy with a Delete action for files that are older than X period of time. If one of the files checked cannot, for whatever reason (a valid use case for this is a non-default logs folder used also by other processes/applications to handle other files), be accessed a java.nio.file.AccessDeniedException is being thrown.
In the version ES is using atm - 2.11.1 - the exception above would have been caught by this try {} catch {} which, in turn, would have been handled by this block of code which is empty. The exception is basically swallowed without any logging whatsoever.
An Elasticsearch user would have noticed that the log files are accumulating, not being deleted as it should and, at the same time, not having a clue why this was like this.
Fortunately, the recent commits referenced above went into 2.12.1 version and now the AccessDeniedException (or any other exception thrown while traversing the list of files) is being logged.