Mandiax / soi-toolkit

Automatically exported from code.google.com/p/soi-toolkit
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

Original issue reported on code.google.com by hakan.d...@gmail.com on 23 Jan 2014 at 8:23

GoogleCodeExporter commented 8 years ago
For release notes: might affect functionality that parse log-files, typically 
for monitoring purposes.

Original comment by hakan.d...@gmail.com on 23 Jan 2014 at 8:29

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r2107.

Original comment by hakan.d...@gmail.com on 23 Jan 2014 at 8:30