[slf4j-dev] Design of MessageFormatter
Ceki Gülcü
listid at qos.ch
Tue Jan 3 16:15:04 CET 2006
Hello Borris,
Thank you for your thought provoking observations. Given the limitations of
what a logging system can and cannot do, I think your second suggestion
paves the way to a good solution.
If you could mention this tread in a bug report, I'd be happy to integrate
a fix for the next release of SLF4J.
Happy new year to all,
At 08:24 PM 12/29/2005, Boris Unckel wrote:
>Hello,
>
>I had a mail conversation where the developer of another JUL-extension asked
>whether my object handling (for Messages with objects or object/object[]
>paramters) is exception safe or not.
>He argues, a logging operation should never lead to an exception in the
>using system, except the logging system itself is corrupt/misconfigured.
>I had a look at my own code, it is currently not exception safe for object
>handling, I have an idea how to solve it.
>
>Different for the native slf4j implemementation:
>I will not change the behaviour/code of the org.slf4j.impl.MessageFormatter
>until discussed here.
>
>The line is 150:
>sbuf.append(argArray[L]);
>What happens here is a null safe operation (OK):
>String.valueOf(argArray[L]);
>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
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
Improve your Sudoku skills at http://www.sudoku-grok.com/
More information about the slf4j-dev
mailing list