[ 
https://issues.apache.org/jira/browse/FELIX-6144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jelle Nelis updated FELIX-6144:
-------------------------------
         Labels: log log-level pull-request-available  (was: log log-level)
    Description: 
The Felix log bundle registers a ConfigurationListener when a 
ConfigurationAdmin instance is present 
([https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/Activator.java#L159]
 and 
[https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L116]).
 This means it gets notified of ALL configuration events. The implementation of 
configurationEvent, however, fails to ignore configuration that is not targeted 
towards the LoggerAdmin. 
[https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L133]
 checks whether or not the pid is meant for a non-root logger context and fills 
in configAdmin if that is the case. In the case it is anything other (not only 
"org.osgi.service.log.admin"), configAdmin will be null and since the following 
lines are not guarded by this if, the configuration of the logger context is 
overwritten by configuration of a random PID 
([https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L148]),
 which in normal cases means all log configuration for the logger context is 
gone at that point.

 

  was:
The Felix log bundle registers a ConfigurationListener when a 
ConfigurationAdmin instance is present 
([https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/Activator.java#L159]
 and 
[https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L116]).
 This means it gets notified of ALL configuration events. The implementation of 
configurationEvent, however, fails to ignore configuration that is not targeted 
towards the LoggerAdmin. 
[https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L133]
 checks whether or not the pid is meant for a non-root logger context and fills 
in configAdmin if that is the case. In the case it is anything other (not only 
"org.osgi.service.log.admin"), configAdmin will be null and since the following 
lines are not guarded by this if, the configuration of the logger context is 
overwritten by configuration of a random PID 
([https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L148]),
 which in normal cases means all log configuration for the logger context is 
gone at that point.

I can provide a PR if needed. Is [https://github.com/apache/felix] the way to 
contribute?


> Root logger context configuration is overwritten when ANY configuration 
> changes
> -------------------------------------------------------------------------------
>
>                 Key: FELIX-6144
>                 URL: https://issues.apache.org/jira/browse/FELIX-6144
>             Project: Felix
>          Issue Type: Bug
>          Components: Log Service
>    Affects Versions: log-1.2.0, log-1.2.2
>            Reporter: Jelle Nelis
>            Priority: Major
>              Labels: log, log-level, pull-request-available
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The Felix log bundle registers a ConfigurationListener when a 
> ConfigurationAdmin instance is present 
> ([https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/Activator.java#L159]
>  and 
> [https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L116]).
>  This means it gets notified of ALL configuration events. The implementation 
> of configurationEvent, however, fails to ignore configuration that is not 
> targeted towards the LoggerAdmin. 
> [https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L133]
>  checks whether or not the pid is meant for a non-root logger context and 
> fills in configAdmin if that is the case. In the case it is anything other 
> (not only "org.osgi.service.log.admin"), configAdmin will be null and since 
> the following lines are not guarded by this if, the configuration of the 
> logger context is overwritten by configuration of a random PID 
> ([https://github.com/apache/felix/blob/7f4bada389ebdaee8b5ae4530c53f2954c8d0fde/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java#L148]),
>  which in normal cases means all log configuration for the logger context is 
> gone at that point.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to