commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Tagunov <>
Subject Re[2]: Debugging LogConfigurationException with commons-logging 1.0.3 (and log4j 1.2.8)
Date Mon, 08 Sep 2003 17:18:25 GMT
Hello, David!

(Err, sorry, this is a response to the original message by
David, but since all I have now is Mattew's response, I'm
responding to it.)

Karr, David wrote:

DK> I'm trying to run some standalone code that uses commons-logging and
DK> log4j, but I'm getting a LogConfigurationException.  I can't find any
DK> useful information on what is really going wrong.

DK> What else can I do to get more information about what is going wrong?

Wow, you can do much: when you print the stack trace to console
unfold any rootCause exceptions that are contained inside yours!

The containers will do that for you (here is a case when running
in a container is easier :-), but when you're on your own

e.printStackTrace() is not enough.

I heartely advice you to get some new commons-lang.jar
(is there are 2.0 release available already? if not some
nightly build?)

There's the


class there. There are static

   ExceptionUtils.printRootStackTrace(Throwable t, PrintStream ps)
   ExceptionUtils.printRootStackTrace(Throwable t, PrintWriter pw)

methods there. In fact, if you were on JDK 1.4
Throwable.printStackTrace() probably would have unfolded what you
need for you. But still AFAICT ExceptionUtils.printRootStackTrace
are a bit more comprehensive: while JDK 1.4
Throwable.printStackTrace() deals only with Throwable.getCause()
provided exception, while ExceptionUtils.printRootStackTrace
dead with


methods (probably via reflection, but who cares if an error has happened :-)

There's also one more difference between Throwable.printStackTrace and
ExceptionUtils.printRootStackTrace - the former first prints the
outmost exception and the innermost - last, while the latter - first
the innermost (hence the name - printRootStackTrace - the root,
innermost) and last - the outmost exception. If my memory serves me

Hope that when all this happens at the end of long unfolding you
gonna arrive to the real exception that will tell what has happened

It's all about people writing code like

   } catch( FooException foo ) {
     throw new BarException("Damn, I failed to do that!", foo);

and all you get if you do not unfold will be this ultra-informative

    Damn, I failed to do that!



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message