Bug 7185 - POI log4J logging defaults to build/poifs.log
Summary: POI log4J logging defaults to build/poifs.log
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 1.5
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-18 00:05 UTC by Andy Oliver
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Oliver 2002-03-18 00:05:47 UTC
When log4j is in the classpath, by default POI just throws this lovely exception:

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: build/poifs.log (No such file or directory)
	at java.io.FileOutputStream.openAppend(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:100)
	at java.io.FileWriter.<init>(FileWriter.java:52)
	at org.apache.log4j.FileAppender.setFile(FileAppender.java:284)
	at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:239)
	at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:247)
	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:123)
	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:87)
	at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:637)
	at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:595)
	at
org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:522)
	at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:412)
	at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:436)
	at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:455)
	at org.apache.log4j.Category.<clinit>(Category.java:146)
	at org.apache.commons.logging.impl.Log4JCategoryLog.<init>(Log4JCategoryLog.java:97)
	at java.lang.reflect.Constructor.newInstance(Native Method)
	at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:487)
	at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:285)
	at org.apache.poi.util.POILogFactory.getLogger(POILogFactory.java:121)
	at org.apache.poi.util.POILogFactory.getLogger(POILogFactory.java:100)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:113)
	at org.apache.poi.hssf.usermodel.examples.NewSheet.main(NewSheet.java:73)
log4j:ERROR setFile(null,true) call failed.

for each package.  IT should be pulling this from an environment variable which
specifies a property file which if anything fails should default to /dev/null.
Lots of folks will not want to use POI's logging but might want to have log4j in
the classpath.
Comment 1 Nicola Ken Barozzi 2002-03-18 09:24:16 UTC
- IT should be pulling this from an environment variable

it does, this is just the default behaviour.

To make thing easier for users, I've changed now the default properties of 
log4j to output to null even when jog4j is present.

To override, one can use commoms logging env variables or simply replace 
src/java/log4j.properties with the one in src/resources/devtools, that works as 
usual for developers.