A better error message sounds like a good idea.
If you make a Jira ticket for this, please make it part of the "ergonomics"
epic: https://issues.apache.org/jira/browse/LOG4J2-1811

On Tue, Apr 11, 2017 at 9:19 PM, Mikael Ståldal <mikael.stal...@magine.com>
wrote:

> Some configuration file formats (JSON, YAML) require additional runtime
> dependencies. If a such dependency is missing, configuration file location
> 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.
>
> Would it make sense to emit a more explicit error message on WARN level
> when this occurs?
>
>
> 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.
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.stal...@magine.com
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>

Reply via email to