Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.8.2
-
None
Description
Some configuration file formats (JSON, YAML) require additional runtime dependencies. If a such dependency is missing, configuration file discovery will stop and not try other configuration files with lower priority.
E.g. if I have both log4j2.json and log4j2.xml in classpath, but not Jackson (required for JSON config), then no configuration file will be loaded and I get this error:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging.
When enabling status logging TRACE, I get a lot of logging (see below) and it's not so easy to figure out what went wrong.
I would like a more clear error message on WARN level when this happen.
DEBUG StatusLogger Loaded Provider Provider[priority=10, className=org.apache.logging.log4j.core.impl.Log4jContextFactory, url=jar:file:/home/mikes/.m2/repository/org/apache/logging/log4j/log4j-core/2.8.2/log4j-core-2.8.2.jar!/META-INF/log4j-provider.properties, classLoader=sun.misc.Launcher$AppClassLoader@18b4aac2] DEBUG StatusLogger Using ShutdownCallbackRegistry class org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin. DEBUG StatusLogger AsyncLogger.ThreadNameStrategy=CACHED TRACE StatusLogger Using default SystemClock for timestamps. DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin. DEBUG StatusLogger Took 0.096889 seconds to load 198 plugins from sun.misc.Launcher$AppClassLoader@18b4aac2 DEBUG StatusLogger PluginManager 'Converter' found 41 plugins DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1 DEBUG StatusLogger Starting LoggerContext[name=18b4aac2, org.apache.logging.log4j.core.LoggerContext@6d8a00e3]... DEBUG StatusLogger Reconfiguration started for context[name=18b4aac2] at URI null (org.apache.logging.log4j.core.LoggerContext@6d8a00e3) with optional ClassLoader: null DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin. DEBUG StatusLogger PluginManager 'ConfigurationFactory' found 4 plugins DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin. DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin. DEBUG StatusLogger Missing dependencies for Yaml support DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin. DEBUG StatusLogger Missing dependencies for Json support DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin. DEBUG StatusLogger Using configurationFactory org.apache.logging.log4j.core.config.ConfigurationFactory$Factory@3a82f6ef TRACE StatusLogger Trying to find [log4j2-test18b4aac2.properties] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.properties] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yaml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.yaml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test18b4aac2.json] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.json] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.json] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.json] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test18b4aac2.jsn] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.jsn] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.jsn] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.jsn] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test18b4aac2.xml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.xml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.xml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test18b4aac2.xml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test.properties] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.properties] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test.yml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.yml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test.yaml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.yaml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test.json] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test.json] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.json] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.json] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test.jsn] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test.jsn] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.jsn] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.jsn] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2-test.xml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2-test.xml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.xml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2-test.xml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j218b4aac2.properties] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j218b4aac2.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.properties] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j218b4aac2.yml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j218b4aac2.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.yml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j218b4aac2.yaml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j218b4aac2.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.yaml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j218b4aac2.json] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j218b4aac2.json] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.json] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.json] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j218b4aac2.jsn] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j218b4aac2.jsn] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.jsn] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.jsn] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j218b4aac2.xml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j218b4aac2.xml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.xml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j218b4aac2.xml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2.properties] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2.properties] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2.properties] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2.yml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2.yml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2.yml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2.yaml] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. TRACE StatusLogger Trying to find [log4j2.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2.yaml] using sun.misc.Launcher$AppClassLoader@18b4aac2 class loader. TRACE StatusLogger Trying to find [log4j2.yaml] using ClassLoader.getSystemResource(). TRACE StatusLogger Trying to find [log4j2.json] using context class loader sun.misc.Launcher$AppClassLoader@18b4aac2. ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging.
Attachments
Issue Links
- relates to
-
LOG4J2-1952 log4j doesn't find log4j2.yaml
- Closed