[slf4j-dev] Re: TRACE level
Greg Wilkins
gregw at mortbay.com
Sun Jul 3 00:44:20 CEST 2005
Ceki Gülcü wrote:
> <request>
>
> Can anyone think of a class which makes uses of both trace() and
> debug()? If so, could you please provide a URL?
>
> </request>
The use case I have for trace (or I prefer to call it verbose) is
the case when I have an object that I wish to log, but that I have
a choice of the amount of detail that can be logged.
Examples include:
HttpRequest: log just the method and URI or all the headers.
Document: log just the URI of the document or dump all of the XML.
I see this as quiet related to ignore, where the developer has
an exception object to log, but has to choose between clogging the
log with excess information or hiding something valuable.
With the case of ignore, the developer has a clear intent that
can be signalled in the signature - to assist a later decision on
how much detail to display. This can be done because the
logging system has the ability to expand the Exception statck trace or
just call toString on it.
With other objects, the logging system will only call toString on
them, so if the developer wants to report an object in detail then
they must do so explicitly - it would be good if they could protect
that with an if(log.isVerboseEnabled()) or an if(log.isTraceEnabled())
But then another solution would be to have a logger that supports
customizable object formatters....
cheers
More information about the slf4j-dev
mailing list