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

Daniel Drozdzewski updated STORM-1767:
--------------------------------------
    Description: 
Current setup of metrics logger ( {{storm/log4j2/worker.xml}}) uses fully 
qualified name of the class where the logging is happening from i.e 
`org.apache.storm.metric.LoggingMetricsConsumer`, which is problematic and does 
not achieve the original intent as stated by the METRICS appender defined in 
{{storm/log4j2/worker.xml}}.

Currently the metrics logger created explicitly by using the name above:
{{LoggerFactory.getLogger("org.apache.storm.metric.LoggingMetricsConsumer")}} 
or implicitly from within the {{LoggingMetricsConsumer}} by calling 
{{LoggerFactory.getLogger(LoggingMetricsConsumer.class)}} will be logging to 
**root** logger.

This happens because logger names use Java namespaces and as such create 
hierarchies. 

The solution is to name metrics logger outside of {{org.apache.storm.*}} 
namespace which is what is happening for all other non-root loggers defined 
within the {{storm/log4j2/worker.xml}} file. 

This will also mean a code change to {{LoggingMetricsConsumer}} class itself 
for it to use the logger with an explicit name matching the name defined in the 
{{worker.xml}} file.

The fix is easy. 


  was:
Current setup of metrics logger (`storm/log4j2/worker.xml`) uses fully 
qualified name of the class where the logging is happening from i.e 
`org.apache.storm.metric.LoggingMetricsConsumer`, which is problematic and does 
not achieve the original intent as stated by the METRICS appender defined in 
`storm/log4j2/worker.xml`.

Currently the metrics logger created explicitly by using the name above:
`LoggerFactory.getLogger("org.apache.storm.metric.LoggingMetricsConsumer")` or 
implicitly from within the `LoggingMetricsConsumer` by calling 
`LoggerFactory.getLogger(LoggingMetricsConsumer.class)` will be logging to 
**root** logger.

This happens because logger names use Java namespaces and as such create 
hierarchies. 

The solution is to name metrics logger outside of `org.apache.storm.*` 
namespace which is what is happening for all other non-root loggers defined 
within the `storm/log4j2/worker.xml` file. 

This will also mean a code change to `LoggingMetricsConsumer` class itself for 
it to use the logger with an explicit name matching the name defined in the 
`worker.xml` file.

The fix is easy. 



> metrics log entries are being appended to root log
> --------------------------------------------------
>
>                 Key: STORM-1767
>                 URL: https://issues.apache.org/jira/browse/STORM-1767
>             Project: Apache Storm
>          Issue Type: Bug
>          Components: storm-core
>    Affects Versions: 1.0.0, 2.0.0
>            Reporter: Daniel Drozdzewski
>              Labels: easyfix
>             Fix For: 1.0.0, 2.0.0
>
>
> Current setup of metrics logger ( {{storm/log4j2/worker.xml}}) uses fully 
> qualified name of the class where the logging is happening from i.e 
> `org.apache.storm.metric.LoggingMetricsConsumer`, which is problematic and 
> does not achieve the original intent as stated by the METRICS appender 
> defined in {{storm/log4j2/worker.xml}}.
> Currently the metrics logger created explicitly by using the name above:
> {{LoggerFactory.getLogger("org.apache.storm.metric.LoggingMetricsConsumer")}} 
> or implicitly from within the {{LoggingMetricsConsumer}} by calling 
> {{LoggerFactory.getLogger(LoggingMetricsConsumer.class)}} will be logging to 
> **root** logger.
> This happens because logger names use Java namespaces and as such create 
> hierarchies. 
> The solution is to name metrics logger outside of {{org.apache.storm.*}} 
> namespace which is what is happening for all other non-root loggers defined 
> within the {{storm/log4j2/worker.xml}} file. 
> This will also mean a code change to {{LoggingMetricsConsumer}} class itself 
> for it to use the logger with an explicit name matching the name defined in 
> the {{worker.xml}} file.
> The fix is easy. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to