Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

LoggingConfiguration.java doesn't follow fallback logic on Malformed URLs #13

@dankirkd

Description

@dankirkd

The "Default Initialization Procedure" section of the https://logging.apache.org/log4j/1.2/manual.html page says that:

"If the resource variable cannot be converted to a URL, for example due to a MalformedURLException, then search for the resource from the classpath by calling org.apache.log4j.helpers.Loader.getResource(resource, Logger.class) which returns a URL. Note that the string "log4j.properties" constitutes a malformed URL."

However, the way the LoggingConfiguration configure method is written, it doesn't do that. If the log4jConfigurationFile (as provided by a -Dlog4j.configuration property) is not null (for example, "mylog4j.properties") it will call loadLog4jConfigurationFile which tries to create a URL and which throws a RuntimeException for the Malformed URL, instead of falling back on looking for the resource in the classpath, which it only does if the log4jConfigurationFile is null.

This is a big miss in the configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions