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

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

Open
dankirkd opened this issue Apr 30, 2015 · 0 comments

Comments

@dankirkd
Copy link

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.

jeremyrsmith added a commit to polynote/polynote that referenced this issue Mar 21, 2019
Share log4j so that it doesn't get re-initialized by notebook code (this can cause exceptions when a non-URL `log4j.configuration` is specified – see Netflix/blitz4j#13)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant