Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-765

Feature request: log warning to console if default configuration is used when missing log4j-core

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0, 2.0.1
    • 2.0.2
    • API, Configurators, Core
    • None

    Description

      To summarize a recent twitter conversation:
      a user became very frustrated that Log4j2 did not log to the configured file, and gave up and moved on to JUL instead.

      After some questions it turned out that (probably) the problem was that they had log4j-api but not log4j-core in the classpath.

      We can dismiss this saying that users should read the documentation better, but users are in a hurry to get things done and I can easily see this happening to more people.

      In the above conversation, the user pointed out that very likely, if someone ends up with the default configuration (log ERROR level messages to the console), they made a mistake.

      The feature request is that log4j should help users by printing a message to the console that explains why the user ended up with the default configuration.

      • In case log4j-core not in the classpath: Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
      • In case no config file was found: No log4j2 configuration file found. Using default configuration: errors to the console.

      This last case is actually a frequent cause of questions on StackOverflow.

      Attachments

        Issue Links

          Activity

            People

              rpopma Remko Popma
              rpopma Remko Popma
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: