Working with Xindice, I sometimes get a bunch of lines in my log that look like:

15827 [Thread-32] WARN indexer.ValueIndexer - java.lang.NullPointerException

without any stack trace available. Now this isn't very useful when trying to figure out what went wrong and where. The problem stems (I assume) from a small misunderstanding regarding the logging API. You *can* pass an Exception as the only parameter to methods like Log.warn(), but they won't be interpreted as Exceptions: they'll be treated just like any other Object, and the logging system will simply call .toString() on them and log the result and nothing more.

So it turns out that changing:

                   try {
                       // ...
                   } catch (Exception e) {
                       log.warn(e);
                   }
to:
                   try {
                       // ...
                   } catch (Exception e) {
                       log.warn("", e);
                   }

would already be a big improvement, and of course having a meaningful description instead of "" would be even better. :) I could roll up my sleeves and submit a patch later on if you guys are interested, but unfortunately I can't get on it right away. This thing called "work" getting in the way. :)

Keep up the great work!

Mario
_________________________
Mario Cormier
Miranda Technologies Inc.
http://www.miranda.com/



Reply via email to