commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boris Unckel" <boris.unckel....@gmx.net>
Subject [logging] Exception handling for messages in wrapper
Date Thu, 29 Dec 2005 19:35:23 GMT
Hello,

in the JDK14Logger is the following code for logging to the underlying JDK
Logger:
log(Level.FINE, String.valueOf(message), null);
message is an java.lang.Object
(the Level differs from each mapping, irrelevant for my point)

What happens here is a null safe operation (OK):
String.valueOf(message)
In case the toString Method throws an RuntimeException (due to bad code in
the using system) it will influence the whole logging operation (canceled),
and cause an error in the using system.

Two ways of solution:
1) Ignore it, the developer of the system is responsible for correct,
exception-free toString implementation of her objects.
I think this is bad, because this may occure in rare runtime situations and
awfully to detect.

2) Signal an error in the user log, giving a hint and a number to lookup for
detailed cause.
Log the detailed reason and number in the underlying log system, or in
x4juli case, in the internal log. (In depracted log4j terms LogLog).

I hope my description is good enough to understand the problem, please ask,
this is important for any implementation.

Opinions? Other solutions? No problem at all?

Regards
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message