Hi,
On Sun, Mar 17, 2002 at 03:06:30PM -0500, Andrew C. Oliver wrote:
> Hi Tom,
>
> Logging in POI is primarily for tracing. We're of the opinion that
> logging is a prevalent concern of everything! Class libraries need it
> for debugging (turn on debug level logging and you find out all sorts of
> things). So as far as Major errors, yes, Exceptions are the preferred
> method of error handling. As far as debugging and diagnostics, well we
> think the logging is a necessary and important thing to have.
ok, I agree. But it would be good, if the log4j stuff is only needed,
if you turn debugging on. In my case - I am not interested in such
logging, I just want to create a stupid excel file. As long as the
beast (M$ Excel) is able to read it I will be totally happy with it.
> Anyhow, this was the biggest problem with POI and I believe Nicola Ken
> Barozzi has fixed it. We just need people to test it. Check out and
> build the sources from CVS on Jakarta and let us know if you have
> problems.
Yes, I did it, I checked out the CVS jakarta-poi module. I build it using
the provided build.sh (which was successfull). It didn't create the *poi-*.jar
files, but the build target "docs" did it.
Unfortunately it still doesn't work. Here is how I call my application:
#!/bin/sh
POI=/home/scip/tmp/jakarta-poi/build/jakarta-poi
CLASSPATH=$CLASSPATH:jzeff.jar:$POI/jakarta-poi.jar:$POI/jakarta-contrib.jar:$POI/lib/optional/log4j-core.jar
java Jzeff
I added log4j-core.jar to the classpath because it was the only .jar
whose name somewhat seemed to match. But if I execute it I get this:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory
at org.apache.poi.util.POILogFactory.<clinit>(POILogFactory.java:76)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:113)
at Jzeff.<init>(Jzeff.java:116)
at Jzeff.main(Jzeff.java:368)
Hm, I stressed find, grep and others, but I didn't find this in the source
tree. So I still need to install log4j.
Is there kinda preprocessor facility available for java? So you can
write
#ifdef HAVE_LOG4J
// use logging
#else
// use System.out.println() or be silent
#endif
just an idea
regards, Tom
> On Sun, 2002-03-17 at 13:37, Thomas Linden wrote:
> > Hi,
> >
> > I found the POI project, which seems to be the thing I was always
> > looking for :-) Thanks for this great classes!
> >
> > But I have one problem with the software. It complains about some
> > classes which I do not have installed here:
> >
> > scip@monster: $ ./jzeff
> > Exception in thread "main" java.lang.NoClassDefFoundError:
>org/apache/log4j/Category
> > at
>net.sourceforge.poi.hssf.usermodel.HSSFWorkbook.<clinit>(HSSFWorkbook.java:127)
> > at Jzeff.<init>(Jzeff.java:115)
> > at Jzeff.main(Jzeff.java:367)
> >
> > After downloading the source I found that HSSF uses a thing called POILogger
> > to log things, for whatever reason. POILogger imports org/apache/log4j/Category
> > and org/apache/log4j/Priority - both are not in the package nor do I have them
> > installed.
> >
> > I assume this stuff is part of jakarta or something, I don't know.
> >
> > The problem is, that my project is a swing gui application, it has nothing
> > to do with java server pages or apache webserver things. Because of this I don't
> > want to include the whole jakarta engine into my project to get the creation
> > of excel files work (beside: how shall I explain this to my users?).
> >
> > So my simple questions are:
> >
> > 1. How do I get rid of the whole logging stuff without completely
> > rewriting or patching POI?
> >
> > or, if the above is not possible:
> >
> > 2. How can I get POI working without installing jakarta (and possibly
> > more stuff) ?
> >
> > and, finally, just because I'm interested:
> >
> > Why does a class library log informations to somewhere? If I had the
> > org/apache/log4j/Category installed I would not know that. IMHO a
> > class library should not log things. It should be completely silent.
> > The only thing it is allowed to do is it's purpose: Do it's job, throw
> > exceptions in case of errors and/or return the appropriate values
> > back to the application that uses it. The application then is responsible
> > to log errors or whatever it decides to log.
> > ^^^^
> >
> > Thanks in advance,
> >
> >
> > - Tom
> >
> >
> > --
> > $_=`perl -v`;s;^.*ll;;s;$^=unpack"u","'8V]D;')E<```";s;\W;;gs;$/=7*
> > ($^=~s;.;;g);%^=map{$_=>1}split//,lc;$_=join$\,(sort keys(%^))[map{
> > ord($_)-$/}split//,'1I7E13?@E:7C1A7C=1:35<7C'];s"0(.)" \U$1"g;print;
> --
> http://www.superlinksoftware.com
> http://jakarta.apache.org/poi - port of Excel/Word/OLE 2 Compound
> Document
> format to java
> http://developer.java.sun.com/developer/bugParade/bugs/4487555.html
> - fix java generics!
> The avalanche has already started. It is too late for the pebbles to
> vote.
> -Ambassador Kosh
--
$_=`perl -v`;s;^.*ll;;s;$^=unpack"u","'8V]D;')E<```";s;\W;;gs;$/=7*
($^=~s;.;;g);%^=map{$_=>1}split//,lc;$_=join$\,(sort keys(%^))[map{
ord($_)-$/}split//,'1I7E13?@E:7C1A7C=1:35<7C'];s"0(.)" \U$1"g;print;