[logback-user] additional informations for appenders?
Ceki Gülcü
ceki at qos.ch
Thu Sep 22 00:29:34 CEST 2011
Hi Lars,
1) For data which stays relatively stable during the scope of (service)
request, MDC is the way to go.
2) You can remove a TurboFilter and attach a modified version
programmatically. You don't need to reset the LoggerContext.
HTH,
On 21/09/2011 3:09 PM, Lars Fischer wrote:
> Hello,
>
> I would like to use slf4j together with logback as logging framework.
> But I have some special requirements, which I'm not happy with them,
> but I can not drop them.
>
> 1) I need to transfer additional informations with each request to the appender.
>
> E.g. a thing like a "logDocumentId". Furthermore, I need to have
> multiple of such Ids active in one session/thread.
> I have to give the id int each request and an own appender
> implementation has to do something with it.
>
> What would be the best way to carry such Id besides the standard log
> message and parameters throug the slf4j api to the logback appenders?
>
> Can I store such objects in the MDC? How does this affect the
> performance, when used on every log request?
>
> Or would it be better to add the informations as additional elements
> at the end of the "argArray" parameter of the Logger methods, hoping
> that all appenders will ignore them, when there is no "{}" for the
> position?
>
>
> 2) I know that logback can be reconfigured on runtime, but all I know
> is that during this re-configuration, all log-requests will be droped.
>
> Is there a way to only add / remove / change a single TurboFilter or
> Appender without losing processing of requests by the "normal" loggers
> / appenders?
> Best regards,
> Lars
--
http://twitter.com/ceki
More information about the Logback-user
mailing list