Bug 40944

Summary: PropertyConfigurator.configure( URL ) does not close the resource stream
Product: Log4j - Now in Jira Reporter: Yaroslav Sokolov <yarick123>
Component: ConfiguratorAssignee: log4j-dev <log4j-dev>
Status: RESOLVED FIXED    
Severity: blocker CC: digulla, kay.abendroth, per.lindberg
Priority: P2 Keywords: PatchAvailable
Version: 1.2   
Target Milestone: ---   
Hardware: All   
OS: Windows XP   
Bug Depends on:    
Bug Blocks: 40951    
Attachments: test case with a patch inside

Description Yaroslav Sokolov 2006-11-10 05:59:17 UTC
Default configuration process does not close input stream which is used to read
"log4j.properties". It causes impossibility to redeploy web application under
windows - the old one cannot be removed as it contains an opened file.

I attach the test case with the patch inside.
Comment 1 Yaroslav Sokolov 2006-11-10 06:05:17 UTC
Created attachment 19108 [details]
test case with a patch inside

the test case contains 2 tests
- the first, test_Log4jCloseConfigStream, does not pass, it shows the described
bug,
- the second, test_PatchedLog4jCloseConfigStream, shows that the offered fix
works

Additionally PatchedPropertyConfigurator contains minor fixes for
PropertyConfigurator.doConfigure(String configFileName, LoggerRepository
hierarchy), which closes the input stream not very correct
Comment 2 Kay Abendroth 2006-11-12 05:21:47 UTC
I can confirm this bug for 1.2.14.
It should be solved before 1.2.15 comes out.

Added as 'depends on' to #40951.
Comment 3 Curt Arnold 2007-02-22 21:27:47 UTC
Committed against 1.2 branch in rev 510831 and rev 510836 for 1.3.  Neither branch caught 
IllegalArgumentException which is thrown if file contains a bad unicode escape sequence.  1.3 attempted 
to close URL stream under normal circumstances.
Comment 4 Curt Arnold 2007-03-08 23:32:43 UTC
*** Bug 41409 has been marked as a duplicate of this bug. ***
Comment 5 Henri Yandell 2007-04-16 08:59:45 UTC
Only comment on this is that the comments in the tests refer to 19108 and not
40944. 10198 is a commons-logging bug from many years back.
Comment 6 Curt Arnold 2007-04-16 09:12:45 UTC
Test comments corrected in rev 529304
Comment 7 Curt Arnold 2007-04-17 08:44:19 UTC
*** Bug 42148 has been marked as a duplicate of this bug. ***
Comment 8 Aaron Digulla 2007-05-30 03:49:37 UTC
Can you please consider a 1.2.15 release because of this bug? When I use 1.2.14
in tomcat, I cannot reliably undeploy a webapp because log4j will not unlock
log4j.properties.
Comment 9 Paul Smith 2007-05-30 15:02:24 UTC
I believe 1.2.15RC2 is available for testing purposes:

http://people.apache.org/builds/logging/log4j/1.2.15/

Be great if you could confirm that rc2 release resolves this issue.  We're
probably not too far away from a vote to release 1.2.15; how that vote goes I
can't say.
Comment 10 Per Lindberg 2007-05-31 06:50:55 UTC
The current Release Candidate for 1.2.15 solves my problem.
So a final release would be nice.