Hi Ceki,
Thanks for the reply.
I've also tried David's suggestion before without any luck (although
logback doesn't yell it me, it doesn't use the default value as well)
BTW, I don't know if it helps or not, but in some config I've tried,
logback didn't threw exception but rather printed all the messages in one
line, seems like something I did made it ignore he %n flag.
my config file is below :
thanks,
Yoni
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<conversionRule conversionWord="host"
converterClass="com.zao.utilities.logging.LogbackHostConverter" />
<conversionRule conversionWord="env"
converterClass="com.zao.utilities.logging.LogbackEnvironmentConverter" />
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<Encoding>UTF-8</Encoding>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>[%-20thread] %d %-5level %-30logger{0} - %env %host
%X{req.xForwardedFor:-none} %X{mdc_username} %X{req.requestURI} -
%message%n</pattern>
</layout>
</appender>
<logger name="com.zao" level="DEBUG"/>
<logger name="org.springframework" level="WARN"/>
<logger name="org.springframework.beans" level="WARN"/>
<logger name="org.springframework.social" level="INFO"/>
<logger name="org.hibernate" level="WARN"/>
<logger name="org.apache" level="WARN"/>
<logger name="ch.qos" level="WARN"/>
<logger name="org.apache.http" level="WARN"/>
<!--
===========================================================================================================
-->
<!-- Root logger configuration
-->
<!--
===========================================================================================================
-->
<root level="DEBUG">
<appender-ref ref="console"/>
</root>
</configuration>
On Sun, May 5, 2013 at 11:38 PM, ceki <[email protected]> wrote:
> Hi Yoni,
>
> Specifying a default value after ':-' should work. This is documented
> at [1]. As this feature is unit tested, I would expect it to work
> without problems. Could you please post your config file on this list?
>
> Thank you in advance,
>
> [1]
> http://logback.qos.ch/manual/**layouts.html#mdc<http://logback.qos.ch/manual/layouts.html#mdc>
>
> On 05.05.2013 19:22, David Roussel wrote:
>
>> Try
>>
>> %X{req.xForwardedFor,NONE}
>>
>> But :- would make more sense.
>>
>> David
>>
>> On 5 May 2013, at 18:18, Yoni Moses <[email protected]> wrote:
>>
>> Hi,
>>>
>>> I've been trying to use the new feature of the MDC without any luck..
>>> it's probably a silly question, but can someone please post exact format
>>> for it?
>>>
>>> I've tried it without any luck...
>>>
>>> from what I've seen in the examples it seems like
>>>
>>> %X{req.xForwardedFor:-NONE}
>>>
>>> should work.. but for me it keeps on saying:
>>> ScanException: Expecting }
>>>
>>> under Parser.expectCurlyRight
>>>
>>> version is 1.0.12 with slf4j 1.7.5
>>>
>>>
>>>
>>> Help is much appreciated ;)
>>>
>>> --
>>> Cheers,
>>> Yoni
>>>
>>
>
> --
> Ceki
> 65% of statistics are made up on the spot
> ______________________________**_________________
> Logback-user mailing list
> [email protected]
> http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>
--
Cheers,
Yoni
_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user