Discussion:
[jira] [Created] (LOG4J2-814) Configuration file loading should be abstracted into a sort of ResourceLoader interface
Matt Sicker (JIRA)
2014-09-05 23:24:29 UTC
Permalink
Matt Sicker created LOG4J2-814:
----------------------------------

Summary: Configuration file loading should be abstracted into a sort of ResourceLoader interface
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker


The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.

Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.

Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Matt Sicker (JIRA)
2014-09-07 23:55:28 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125099#comment-14125099 ]

Matt Sicker commented on LOG4J2-814:
------------------------------------

I think this might be able to replace the existing ResourceLoader stuff I added a while back for OSGi support (especially since I figured out how to use a Bundle ClassLoader as demonstrated in log4j-api). As part of this work, I think adding an {{spi}} package in log4j-core is in order. Possibly move some classes there as well such as ShutdownRegistrationStrategy, Clock (though it might be too late?), SecretKeyProvider (ditto), LogEventFactory (not really sure what it's doing in {{impl}}), and ResourceLoader (new version).
Post by Matt Sicker (JIRA)
Configuration file loading should be abstracted into a sort of ResourceLoader interface
---------------------------------------------------------------------------------------
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker
The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.
Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.
Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Matt Sicker (JIRA)
2014-09-08 01:13:28 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125125#comment-14125125 ]

Matt Sicker commented on LOG4J2-814:
------------------------------------

I'll be working on this in the LOG4J2-814 branch.
Post by Matt Sicker (JIRA)
Configuration file loading should be abstracted into a sort of ResourceLoader interface
---------------------------------------------------------------------------------------
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker
The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.
Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.
Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Ralph Goers (JIRA)
2014-09-08 02:24:28 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125152#comment-14125152 ]

Ralph Goers commented on LOG4J2-814:
------------------------------------

I don't really understand what you are after from the description so I definitely want to review this before you merge it to trunk.
Post by Matt Sicker (JIRA)
Configuration file loading should be abstracted into a sort of ResourceLoader interface
---------------------------------------------------------------------------------------
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker
The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.
Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.
Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Matt Sicker (JIRA)
2014-09-08 04:09:28 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125202#comment-14125202 ]

Matt Sicker commented on LOG4J2-814:
------------------------------------

I'm somewhat experimenting a bit here, but yeah, I'm definitely not merging this without some review. The main idea is that I'm borrowing the concept of the Resource interface from Spring. Moving this into the plugin system can provide simpler ways to extend the logic from ConfigurationFactory for different configuration file loading mechanisms. The ConfigurationSource class can be abstracted into the Resource interface.

I'll push more changes later when I've got more of this done.
Post by Matt Sicker (JIRA)
Configuration file loading should be abstracted into a sort of ResourceLoader interface
---------------------------------------------------------------------------------------
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker
The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.
Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.
Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Remko Popma (JIRA)
2014-09-08 07:28:28 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125272#comment-14125272 ]

Remko Popma commented on LOG4J2-814:
------------------------------------

Please take this as positive criticism, but to be honest, I'm not clear on what problem you are trying to solve. Could you add more detail on the _problem_ to the Description? Currently the focus (in both the Description and subsequent comments) is only on the _solution_...

Is there a concrete use case/scenario of something you would like to do but cannot (easily) do at the moment?
Post by Matt Sicker (JIRA)
Configuration file loading should be abstracted into a sort of ResourceLoader interface
---------------------------------------------------------------------------------------
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker
The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.
Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.
Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Matt Sicker (JIRA)
2014-09-08 18:43:28 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125898#comment-14125898 ]

Matt Sicker commented on LOG4J2-814:
------------------------------------

I'm going to stash this idea for now. The more I look at what I was doing, the more it seems like I was reinventing an entirely new interface for ConfigurationSource.
Post by Matt Sicker (JIRA)
Configuration file loading should be abstracted into a sort of ResourceLoader interface
---------------------------------------------------------------------------------------
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker
The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.
Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.
Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Matt Sicker (JIRA)
2014-09-25 02:58:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Sicker closed LOG4J2-814.
------------------------------
Resolution: Duplicate

Turns out that ConfigurationSource is basically the same thing.
Post by Matt Sicker (JIRA)
Configuration file loading should be abstracted into a sort of ResourceLoader interface
---------------------------------------------------------------------------------------
Key: LOG4J2-814
URL: https://issues.apache.org/jira/browse/LOG4J2-814
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: Matt Sicker
The main bit of code to look at here is in {{ConfigurationFactory.getInputFromUri(URI)}}, which returns a ConfigurationSource. Now, sure, a user can override the default ConfigurationFactory class and override that method. However, I think it may be more beneficial to use a sort of resource loader plugin architecture similar to [Spring|http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html] for the same reasons specified by Spring. These could be standard Log4j plugins which would be mapped to URI schemes, and we'd have a few implementations as well.
Ideally, we should be able to use URI (or some abstracted class like Resource) everywhere to specify a configuration file location so that this architecture could be used generically. Plus, going this route would be more Log4j-like than specifying a system property and globally overriding the ConfigurationFactory.
Config file change monitoring would be a good thing to keep in mind for any implementation of this idea.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Loading...