[MAGNOLIA-1597] Log4jConfigurer fails to locate log4j configuration file if property file format used Created: 15/Jun/07  Updated: 23/Jan/13  Resolved: 29/Jul/08

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 3.0.1
Fix Version/s: 3.6.1

Type: Bug Priority: Major
Reporter: Konstantin Zadorozhny Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File Log4jConfigurer.java.patch    
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   

There is a bug in Log4jConfigurer initLogging method. The PropertyConfigurator.configure(log4jFileName) call should use properties as a parameter.

else {
Properties properties = new Properties();
try

{ properties.load(IOUtils.toInputStream(config)); }

catch (IOException e)

{ log("Unable to initialize Log4J from [" //$NON-NLS-1$ + log4jFileName + "], got an Exception during reading the properties file " //$NON-NLS-1$ + e.getMessage()); return; }

PropertyConfigurator.configure(log4jFileName); // FIXME
}



 Comments   
Comment by Magnolia International [ 15/Jun/07 ]

Can you please provide a patch for faster inclusion / better view of the actual change? thanks.

Comment by Philippe Marschall [ 29/Jul/08 ]

Fix attached.

The problem is that you use the original, relative file name to configure log4j which can't find it. What should be used instead is the in memory stream for which variables have been replaced.

Comment by Magnolia International [ 29/Jul/08 ]

patch applied, thanks !

Generated at Mon Feb 12 03:28:27 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.