In general you do not want POI to log anything. Serious errors are thrown back to you application. In general POI's logging is more like debug tracing. It would slow down a production app 100-fold or more if turned on!
-Andy Gus Power wrote: > Hi Edgar, > > Yep, that allows the project to run and the tests to fail [XP -test > first :)], this time for the correct reasons. Thanks! > > [I see that from looking at the jars' manifest that it is in fact > Log4j 1.2 alpha 7.] > > Unfortunately the logging function doesn't appear to work, with the > following message: > 'log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not > assignable to a "org.apache.log4j.Appender" variable.' > I see that this is a known bug when running under ANT and JUnit and > appears to have been fixed in Log4j 1.2 Beta 4. [see the mail from 4th > March entitled 'log4j 1.2 beta4 available' on the log4j-user list.] > > For now, I will continue on without the logging functionality until > the POI tree and/or the commons logging package have been patched. > > Thanks for your help - it has been much appreciated, > > Gus > > -----Original Message----- > From: Graaf, Edgar de (fin) [mailto:[EMAIL PROTECTED] ] > Sent: 05 April 2002 14:36 > To: '[EMAIL PROTECTED]' > Subject: RE: Problems with Log4j > > > I have that too. I had an old one. Try this jar (see attachment). > Cocoon used it at this one did work. > > Regards, > > Edgar > -----Oorspronkelijk bericht----- > Van: Gus Power [mailto:[EMAIL PROTECTED] ] > Verzonden: vrijdag 5 april 2002 15:26 > Aan: '[EMAIL PROTECTED]' > Onderwerp: Problems with Log4j > > > Hi, > I am currently trying to integrate POI into an existing project that > makes use of log4j. Unfortunately I have been unsuccessful [so far] in > getting the two to work together - below is a series of cases I have > tried to get a working result, including the jars used and the > exceptions encountered. The project into which I am trying to > integrate POI uses a basic ANT script to clean-compile-jar-sign-test - > I encounter the exceptions in the JUnit window as it begins to run the > 1st test utilizing the HSSF module. > > Any help that anyone can lend me to get this working would be much > appreciated. > Case 1. [POI 1.4583 Release, Log4j 1.2 Beta 4, Commons Logging 1.0] > Exception: > java.lang.NoSuchFieldError: INFO > at > org.apache.poi.util.POILogFactory.<init>(POILogFactory.java:120) > at org.apache.poi.hssf.HSSFLog.<init>(HSSFLog.java:85) > at org.apache.poi.hssf.HSSFLog.getPOILogger(HSSFLog.java:92) > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:115) > > ... > Jars Used: > jakarta-poi-1.1-dev.jar from jakarta-poi-1.4583-dev-bin.tar.gz > commons-logging-1.0.jar log4j-1.2beta4.jar > Case 2. [POI 1.4583 Release, Log4j 1.1.3, Commons Logging 1.0] > Exception: > java.lang.NoClassDefFoundError: org/apache/log4j/Logger > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:115) > > ... > Jars Used: > jakarta-poi-1.1-dev.jar from jakarta-poi-1.4583-dev-bin.tar.gz > commons-logging-1.0.jar log4j.jar from jakarta-log4j-1.1.3.tar.gz > > Case 3. [POI 1.4583 Release, Log4j Core from CVS, Commons Logging 1.0] > Downloaded CVS tree [05/04/2002] > Exception: > java.lang.NoClassDefFoundError: org/apache/log4j/Logger > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:115) > > ... > Jars Used: > jakarta-poi-1.1-dev.jar from jakarta-poi-1.4583-dev-bin.tar.gz > commons-logging-1.0.jar log4j-core.jar from CVS download [77K Modified > 14/03/2002 @ 11:05] > > Case 4. [POI built from CVS, Log4j Core from CVS, Commons Logging 1.0] > Built POI jar: build.bat -> selected 'compile' target; created jar > manually [jar -cvf jakarta-poi-05042002.jar *.*] > > Exception: > java.lang.ExceptionInInitializerError: > org.apache.commons.logging.LogConfigurationException: > java.lang.ClassCastException: > org.apache.commons.logging.impl.LogFactoryImpl > > at > org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:497) > at > org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350) > at > org.apache.poi.util.POILogFactory.<clinit>(POILogFactory.java:76) > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:113) > > ... > Jars Used: > jakarta-poi-05042002.jar [Freshly built] commons-logging-1.0.jar > log4j-core.jar from CVS download [77K Modified 14/03/2002 @ 11:05] > > Case 5. [Try to build POI distro using 'dist' target] > build.bat -> Select 'dist' target > Info screen says that script is about to build src and bin > distributions Runs 'dist-src' target Runs 'dist-src-tgz' target > (Unusual warning "Nothing to do" from gzip, tar isn't gzipped) > [Creates jakarta-poi-1.5.0-dev-src.tar in dist directory] Runs > 'dist-src-zip' target [Creates jakarta-poi-1.5.0-dev-src.zip in dist > directory] Runs 'dist' target and ends abruptly [no warnings] No > binary distribution targets were created. > > Case 6. [POI built from CVS with Log4j 1.1.3, Commons Logging 1.0] > Removed build and dist directories Deleted log4j-core.jar in > lib\optional directory Added log4j.jar from jakarta-log4j-1.1.3.tar.gz > into lib\optional directory Built POI jar: build.bat -> selected > 'compile' target; created jar manually [jar -cvf > jakarta-poi-05042002.jar *.*] (Well actually I typed 'tar -cvf ...' > and sat there wondering why until my sanity kicked back in again for a > bit) > > Exception: > java.lang.ExceptionInInitializerError: > org.apache.commons.logging.LogConfigurationException: > java.lang.ClassCastException: > org.apache.commons.logging.impl.LogFactoryImpl > > at > org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:497) > at > org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350) > at > org.apache.poi.util.POILogFactory.<clinit>(POILogFactory.java:76) > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:113) > > ... > Jars Used: > jakarta-poi-05042002.jar [Freshly built] commons-logging-1.0.jar > log4j.jar from jakarta-log4j-1.1.3.tar.gz > Thanks & Regards, > Gus Power. >
