Bug 52808 - Creating HSSFWorkbook instance resets log4j log level to WARN
Summary: Creating HSSFWorkbook instance resets log4j log level to WARN
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.7-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-02 05:38 UTC by Ravi
Modified: 2012-03-05 05:26 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi 2012-03-02 05:38:55 UTC
I am using POI's HSSF to read data from an MS excel sheet. I also use log4j in my project for logging. Here is what I do in my project:
1. Initialize logging (log level is set to INFO in log4j.properties)
2. Do stuff: log.info works fine here
3. Read an excel sheet using HSSF
4. Do stuff: log.info doesn't show output, log.warn & log.error work fine however

By reinitializing logging (reexecuting step 1 above) after step 3, log.info works fine again.

This issue is observed in build 1.7 (poi-3.7-20101029.jar) and also in the latest 1.8 beta (poi-3.8-beta5-20111217.jar).
Comment 1 Yegor Kozlov 2012-03-02 12:36:01 UTC
I can't reproduce it. Can you narrow it down to a simple isolated test so that we can confirm the problem? 

POI does not use the log4j framework directly but can be configured to delegate logging to log4j via Apache Commons Logging. Did you set it so ? Even if you did, I don't see how it can interfere with existing log4j setup.

Check that you don't have multiple log4.properties in the classpath. 

Try to track the code that resets log4. The simplest way is to set a breakpoint inside log4 and see what place is actually calling it. I will very surprised if it is POI.

Yegor
Comment 2 Ravi 2012-03-05 05:26:58 UTC
Yeah, I tried again with a simple project without any complexity. I did not see the issue.

In the earlier project I used this, there was another application (using log4j) JAR being used. It is a bit strange, but the logging level gets reset to this other application's log level only after HSSF code is invoked. I will debug further and let you know if I feel it is a bug with HSSF. I am closing this bug.

Thanks!