You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Krzysztof Gąsior (Jira)" <ji...@apache.org> on 2021/10/27 16:29:00 UTC

[jira] [Updated] (LOG4J2-3181) When custom configurationFile is missing

     [ https://issues.apache.org/jira/browse/LOG4J2-3181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Krzysztof Gąsior updated LOG4J2-3181:
-------------------------------------
    Description: 
So I am using following setting to define 'external' logger configuration file
{code:java}
-Dlog4j.configurationFile=/etc/xxx/log4j2.properties
{code}
I also put a default config inside the package with assumption to use it as a fallback, however if the 'external' configuration file does not exist following occurs:
{code:java}
ERROR StatusLogger File not found in file system or classpath: /etc/xxx/log4j2.properties
ERROR StatusLogger Reconfiguration failed: No configuration found for '27bc2616' at 'null' in 'null'{code}
and as a result logger is not configured at all and not logging anything, despite the fallback config is inside the package. There is a similar problem described in following [SO ticket|https://stackoverflow.com/questions/58338411/how-to-fall-back-to-log4j2-xml-when-custom-configurationfile-is-missing]

In such situation I would expect log4j2 to follow the automatic configuration path as defined here: [https://logging.apache.org/log4j/2.x/manual/configuration.html]
 and use properties from class path or if those not found to fallback to a default settings. If not as a default behavior there at least should be way to force it to work that way.

Note that there is also a second issue, if define multiple configs via configurationFile, even if single of those fails to be found then same issue as above happens, and we get no configuration at all.

  was:
So I am using following setting to define 'external' logger configuration file

 
{code:java}
-Dlog4j.configurationFile=/etc/xxx/log4j2.properties
{code}
I also put a default config inside the package with assumption to use it as a fallback, however if the 'external' configuration file does not exist following occurs:

 
{code:java}
ERROR StatusLogger File not found in file system or classpath: /etc/xxx/log4j2.properties
ERROR StatusLogger Reconfiguration failed: No configuration found for '27bc2616' at 'null' in 'null'{code}
and as a result logger is not configured at all and not logging anything, despite the fallback config is inside the package. There is a similar problem described in following [SO ticket|https://stackoverflow.com/questions/58338411/how-to-fall-back-to-log4j2-xml-when-custom-configurationfile-is-missing]

In such situation I would expect log4j2 to follow the automatic configuration path as defined here: [https://logging.apache.org/log4j/2.x/manual/configuration.html]
and use properties from class path or if those not found to fallback to a default settings. If not as a default behavior there at least should be way to force it to work that way.

Note that there is also a second issue, if define multiple configs via configurationFile, even if single of those fails to be found then same issue as above happens, and we get no configuration at all.


> When custom configurationFile is missing 
> -----------------------------------------
>
>                 Key: LOG4J2-3181
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3181
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.13.0
>            Reporter: Krzysztof Gąsior
>            Priority: Major
>
> So I am using following setting to define 'external' logger configuration file
> {code:java}
> -Dlog4j.configurationFile=/etc/xxx/log4j2.properties
> {code}
> I also put a default config inside the package with assumption to use it as a fallback, however if the 'external' configuration file does not exist following occurs:
> {code:java}
> ERROR StatusLogger File not found in file system or classpath: /etc/xxx/log4j2.properties
> ERROR StatusLogger Reconfiguration failed: No configuration found for '27bc2616' at 'null' in 'null'{code}
> and as a result logger is not configured at all and not logging anything, despite the fallback config is inside the package. There is a similar problem described in following [SO ticket|https://stackoverflow.com/questions/58338411/how-to-fall-back-to-log4j2-xml-when-custom-configurationfile-is-missing]
> In such situation I would expect log4j2 to follow the automatic configuration path as defined here: [https://logging.apache.org/log4j/2.x/manual/configuration.html]
>  and use properties from class path or if those not found to fallback to a default settings. If not as a default behavior there at least should be way to force it to work that way.
> Note that there is also a second issue, if define multiple configs via configurationFile, even if single of those fails to be found then same issue as above happens, and we get no configuration at all.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)