[MAGNOLIA-3396] log4j.xml in magnolia-core Created: 19/Nov/10 Updated: 04/Nov/15 Resolved: 04/Nov/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core |
| Affects Version/s: | 4.3.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Philipp Gaschütz | Assignee: | Philipp Bärfuss |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Java6, Tomcat6, slf4j, log4j |
||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
magnolia-core includes a log4j.xml configuration file in its root directory. If one wants to use other projects which itself use slf4j/log4j or log4j on their own and one wants to use a log4j.properties file instead of the XML based configuration, one needs to (well, first figure out, and then) add a "-Dlog4j.configuration=log4j.properties" system property to java options, since log4j will first search for XML based configuration files on the classpath and then for the .properties files. I can't see a need for magnolia-core including a log4j.xml in its root directory, expecially because magnolia has its own Log4J configurer, which only initializes log4j if a log4j configuration property has been set in magnolia.properties. In turn, not specifying it probably means, that the developer had other intentions anyway. Thanks |
| Comments |
| Comment by Magnolia International [ 17/Dec/10 ] |
|
Philipp, Am I guessing correctly that using "-Dlog4j.configuration=log4j.properties" will only be effective until Magnolia's custom log4j configurer reconfigures log4j ? Given that we can't afford to not log the boot phase, what would you suggest ? I guess replacing this xml by a properties would not help, as it would conflict with your other projects anyway. (i.e an arbitrary one would be picked up depending on classpath order, I guess) |
| Comment by Philipp Gaschütz [ 17/Dec/10 ] |
|
Hi Gregory, ok, understood... makes sense. However, replacing the log4j.xml with a .properties file would indeed make a change, since log4j will first search the classpath for any .xml configurations and only after it has found none, will scan the classpath for a log4j.properties - and I would have thought it would do so from bottom to top (ie. the classloader would check /WEB-INF/classes first) Best |
| Comment by Philipp Gaschütz [ 17/Dec/10 ] |
|
Quick ammendment: If you include your own log4j.properties file, this would be picked up before the log4j.properties included in magnolia. See http://www.slf4j.org/legacy.html#log4j-over-slf4j --> "When does it not work" At the end of the day, it's not too much of an urgent issue, I eventually simply switched to logback and things worked fine. But it took me quite some time to figure out where my log messages were going, until I found out that they were swallowed due to the magnolia initialization process. |
| Comment by Magnolia International [ 21/Dec/10 ] |
|
Thanks for the insight. I wonder if there is a way to have the boot phase logging less intrusive. Any idea ? |
| Comment by Michael Mühlebach [ 04/Nov/15 ] |
|
Given the thousands of other issues we have open that are more highly requested, we won't be able to address this issue in the foreseeable future. Instead we will focus on issues with a higher impact, and more votes. |