Felix Meschberger created SLING-6220:
----------------------------------------
Summary: [log] Perform initial configuration from framework
properties synchronously
Key: SLING-6220
URL: https://issues.apache.org/jira/browse/SLING-6220
Project: Sling
Issue Type: Improvement
Components: Commons
Reporter: Felix Meschberger
{{LogbackManager}} uses {{LogConfigManager}} to support traditional logging
configuration including initial (global) configuration from framework
properties. Once everything is setup the {{LogbackManager.configChanged()}}
method is called to initiate logging for the first time.
Unfortunately {{configChanged}} is processed asynchronously leading to initial
configuration to be applied only later - in some special use cases even *after*
the complete application has already started.
I proposed to replace the call to {{configChanged()}} by a call to
{{configure()}} which actually implements the configuration change *before* the
{{started}} flag is set to {{true}}.
Proposed patch:
{code}
Index:
src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java
===================================================================
---
src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java
(Revision 1767024)
+++
src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java
(Arbeitskopie)
@@ -167,8 +167,13 @@
registerWebConsoleSupport();
registerEventHandler();
+ // initial configuration must be done synchronously (aka immediately)
+ addInfo("LogbackManager: BEGIN initial configuration");
+ configure();
+ addInfo("LogbackManager: END initialconfiguration");
+
+ // now open the gate for regular configuration
started = true;
- configChanged();
}
public void shutdown() {
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)