On Thu, 2005-12-29 at 20:35 +0100, Boris Unckel wrote: > 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.
+1 > 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). hmmm... JCL is probably too thin to do too: maybe should output some diagnostics (if it's switched on) but yes, runtime exceptions in toString() should be caught. maybe just pass a standard string on to the logging subsystem. > I hope my description is good enough to understand the problem, please ask, > this is important for any implementation. your explanation was very good :) > Opinions? Other solutions? No problem at all? i agree with your diagnosis and prognosis: submit a patch ;) - robert --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
