SiftingAppender question

Hi Is it possible to configure the SiftingAppender to use parameters from MDC other than the discriminator ? I'd like to achive the following : in java: MDC.put("logger", loggerName); MDC.put("file", fileName); MDC.put("pattern", pattern); in config: <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender"> <discriminator> <Key>logger</Key> <DefaultValue>default</DefaultValue> </discriminator> <sift> <appender name="FILE-${logger}" class="ch.qos.logback.core.FileAppender"> <File>${file}</File> <Append>true</Append> <Encoding>UTF-8</Encoding> <BufferedIO>true</BufferedIO> <ImmediateFlush>true</ImmediateFlush> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>{pattern:-%d [%thread] %level %mdc %logger{35} - %msg%n}</Pattern> </layout> </appender> </sift> </appender> Thanks Gabor Dolla

On 04.10.2010 13:17, Gabor Dolla wrote:
Hi
Is it possible to configure the SiftingAppender to use parameters from MDC other than the discriminator ?
SiftingAppender takes a disriminator object as a configuration parameter. In the absence of a discriminator specification, SiftingAppender defaults to a discriminator of type *MDCBasedDiscriminator* which uses the contents of the MDC for its discriminating action. You can choose which key to use, e.g. logger of your example. Does this answer your question? -- Ceki

Hi and thank you for helping me. Unfortunatelly this does not answer my question. I understand the discriminator object. What I 'd like to achieve is that when the siftingappender creates a new appender because the discriminator object is new then the new appender should take certain parameters (filename, pattern) from mdc. Thanks Gabor On Mon, Oct 4, 2010 at 7:22 PM, Ceki Gulcu <ceki@qos.ch> wrote:
On 04.10.2010 13:17, Gabor Dolla wrote:
Hi
Is it possible to configure the SiftingAppender to use parameters from MDC other than the discriminator ?
SiftingAppender takes a disriminator object as a configuration parameter. In the absence of a discriminator specification, SiftingAppender defaults to a discriminator of type *MDCBasedDiscriminator* which uses the contents of the MDC for its discriminating action. You can choose which key to use, e.g. logger of your example.
Does this answer your question?
-- Ceki
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

You could have parameter values read from MDC if you were using GSiftingAppender, the equivalent of SiftingAppender written in Groovy. Is using Groovy an option for you? On 04.10.2010 19:40, Gabor Dolla wrote:
Hi and thank you for helping me.
Unfortunatelly this does not answer my question.
I understand the discriminator object. What I 'd like to achieve is that when the siftingappender creates a new appender because the discriminator object is new then the new appender should take certain parameters (filename, pattern) from mdc.
Thanks
Gabor
On Mon, Oct 4, 2010 at 7:22 PM, Ceki Gulcu <ceki@qos.ch <mailto:ceki@qos.ch>> wrote:
On 04.10.2010 13:17, Gabor Dolla wrote:
Hi
Is it possible to configure the SiftingAppender to use parameters from MDC other than the discriminator ?
SiftingAppender takes a disriminator object as a configuration parameter. In the absence of a discriminator specification, SiftingAppender defaults to a discriminator of type *MDCBasedDiscriminator* which uses the contents of the MDC for its discriminating action. You can choose which key to use, e.g. logger of your example.
Does this answer your question?
-- Ceki
_______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Hi Groovy is an option and I'm working on the groovy script already but I hoped for a simple solution because I fear that the groovy version will be slow. Anyway, thanks for your effort. Gabor On Mon, Oct 4, 2010 at 8:49 PM, Ceki Gulcu <ceki@qos.ch> wrote:
You could have parameter values read from MDC if you were using GSiftingAppender, the equivalent of SiftingAppender written in Groovy. Is using Groovy an option for you?
On 04.10.2010 19:40, Gabor Dolla wrote:
Hi and thank you for helping me.
Unfortunatelly this does not answer my question.
I understand the discriminator object. What I 'd like to achieve is that when the siftingappender creates a new appender because the discriminator object is new then the new appender should take certain parameters (filename, pattern) from mdc.
Thanks
Gabor
On Mon, Oct 4, 2010 at 7:22 PM, Ceki Gulcu <ceki@qos.ch <mailto:ceki@qos.ch>> wrote:
On 04.10.2010 13:17, Gabor Dolla wrote:
Hi
Is it possible to configure the SiftingAppender to use parameters from MDC other than the discriminator ?
SiftingAppender takes a disriminator object as a configuration parameter. In the absence of a discriminator specification, SiftingAppender defaults to a discriminator of type *MDCBasedDiscriminator* which uses the contents of the MDC for its discriminating action. You can choose which key to use, e.g. logger of your example.
Does this answer your question?
-- Ceki
_______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch>
http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
participants (2)
-
Ceki Gulcu
-
Gabor Dolla