soi-toolkit / soi-toolkit-mule

SOI Toolkit and Mule ESB
Apache License 2.0
6 stars 1 forks source link

log4j-config: log the category instead of caller class name #363

Closed hdahl closed 9 years ago

hdahl commented 9 years ago

Original issue 363 created by soi-toolkit on 2014-01-23T20:23:36.000Z:

Problem

The current log4j-pattern:

%d %-5p %-30C - %m%n

outputs the caller name (which is also slow to generate according to docs) instead of the category. The result is misleading/non-helpful logs regarding where a log was written from.

Example: see that logging seems to come from "org.mule.module.logging.DispatchingLogger"

2014-01-23 20:09:31,644 INFO org.mule.module.logging.DispatchingLogger - Loading XML bean definitions from class path resource [soitoolkit-mule-file-connector.xml] 2014-01-23 20:09:36,213 INFO org.mule.module.logging.DispatchingLogger - soi-toolkit.log \ logEvent-info.start ***

Proposed solution

Change the pattern to (note: lowercase "c" instead of uppercase "C"):

%d %-5p %-30c - %m%n

Example: see how the "org.mule.module.logging.DispatchingLogger" from the previous example is replaced with meaningful info:

2014-01-23 21:07:16,178 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [soitoolkit-mule-file-connector.xml] 2014-01-23 21:07:21,321 INFO org.soitoolkit.commons.mule.messageLogger - soi-toolkit.log \ logEvent-info.start ***

Ref: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html

hdahl commented 9 years ago

Comment #1 originally posted by soi-toolkit on 2014-01-23T20:29:24.000Z:

For release notes: might affect functionality that parse log-files, typically for monitoring purposes.

hdahl commented 9 years ago

Comment #2 originally posted by soi-toolkit on 2014-01-23T20:30:12.000Z:

This issue was closed by revision r2107.