Bug 40944 - PropertyConfigurator.configure( URL ) does not close the resource stream
Summary: PropertyConfigurator.configure( URL ) does not close the resource stream
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Configurator (show other bugs)
Version: 1.2
Hardware: All Windows XP
: P2 blocker
Target Milestone: ---
Assignee: log4j-dev
Keywords: PatchAvailable
: 41409 42148 (view as bug list)
Depends on:
Blocks: 40951
  Show dependency tree
Reported: 2006-11-10 05:59 UTC by Yaroslav Sokolov
Modified: 2007-05-31 06:50 UTC (History)
3 users (show)

test case with a patch inside (4.01 KB, text/plain)
2006-11-10 06:05 UTC, Yaroslav Sokolov

Note You need to log in before you can comment on or make changes to this bug.
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
- the second, test_PatchedLog4jCloseConfigStream, shows that the offered fix

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
Comment 9 Paul Smith 2007-05-30 15:02:24 UTC
I believe 1.2.15RC2 is available for testing purposes:


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.