<div dir="ltr">Hi Ceki,<div><br></div><div>Thanks for the reply.</div><div><br></div><div style>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)</div>
<div style><br></div><div style>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.</div>
<div style><br></div><div style>my config file is below :</div><div style><br></div><div style><br></div><div style>thanks,</div><div style>Yoni</div><div style><br></div><div style><br></div><div style><br></div><div style>
<div><?xml version="1.0" encoding="UTF-8"?></div><div><br></div><div><configuration></div><div><span class="" style="white-space:pre"> </span><conversionRule conversionWord="host"</div>
<div><span class="" style="white-space:pre"> </span> converterClass="com.zao.utilities.logging.LogbackHostConverter" /></div><div><br></div><div><br></div><div><span class="" style="white-space:pre"> </span><conversionRule conversionWord="env"</div>
<div><span class="" style="white-space:pre"> </span> converterClass="com.zao.utilities.logging.LogbackEnvironmentConverter" /></div><div><br></div><div><span class="" style="white-space:pre"> </span><appender name="console" class="ch.qos.logback.core.ConsoleAppender"><br>
</div><div><span class="" style="white-space:pre"> </span><Encoding>UTF-8</Encoding></div><div><span class="" style="white-space:pre"> </span><layout class="ch.qos.logback.classic.PatternLayout"></div>
<div><span class="" style="white-space:pre"> </span><pattern>[%-20thread] %d %-5level %-30logger{0} - %env %host %X{req.xForwardedFor:-none} %X{mdc_username} %X{req.requestURI} - %message%n</pattern></div><div>
<span class="" style="white-space:pre"> </span></layout></div><div><span class="" style="white-space:pre"> </span></appender></div><div><br></div><div><span class="" style="white-space:pre"> </span><logger name="com.zao" level="DEBUG"/><br>
</div><div><span class="" style="white-space:pre"> </span><logger name="org.springframework" level="WARN"/></div><div><span class="" style="white-space:pre"> </span><logger name="org.springframework.beans" level="WARN"/></div>
<div><span class="" style="white-space:pre"> </span><logger name="org.springframework.social" level="INFO"/></div><div><span class="" style="white-space:pre"> </span><logger name="org.hibernate" level="WARN"/></div>
<div><span class="" style="white-space:pre"> </span><logger name="org.apache" level="WARN"/></div><div><span class="" style="white-space:pre"> </span><logger name="ch.qos" level="WARN"/></div>
<div><span class="" style="white-space:pre"> </span><logger name="org.apache.http" level="WARN"/></div><div><br></div><div><br></div><div><span class="" style="white-space:pre"> </span><!-- =========================================================================================================== --></div>
<div><span class="" style="white-space:pre"> </span><!-- Root logger configuration --></div><div><span class="" style="white-space:pre"> </span><!-- =========================================================================================================== --></div>
<div><span class="" style="white-space:pre"> </span><root level="DEBUG"></div><div><span class="" style="white-space:pre"> </span><appender-ref ref="console"/></div><div><span class="" style="white-space:pre"> </span></root></div>
<div><br></div><div><br></div><div></configuration></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, May 5, 2013 at 11:38 PM, ceki <span dir="ltr"><<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Yoni,<br>
<br>
Specifying a default value after ':-' should work. This is documented<br>
at [1]. As this feature is unit tested, I would expect it to work<br>
without problems. Could you please post your config file on this list?<br>
<br>
Thank you in advance,<br>
<br>
[1] <a href="http://logback.qos.ch/manual/layouts.html#mdc" target="_blank">http://logback.qos.ch/manual/<u></u>layouts.html#mdc</a><br>
<br>
On 05.05.2013 19:22, David Roussel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Try<br>
<br>
%X{req.xForwardedFor,NONE}<br>
<br>
But :- would make more sense.<br>
<br>
David<br>
<br>
On 5 May 2013, at 18:18, Yoni Moses <<a href="mailto:yoni.moses@gmail.com" target="_blank">yoni.moses@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
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?<br>
<br>
I've tried it without any luck...<br>
<br>
from what I've seen in the examples it seems like<br>
<br>
%X{req.xForwardedFor:-NONE}<br>
<br>
should work.. but for me it keeps on saying:<br>
ScanException: Expecting }<br>
<br>
under Parser.expectCurlyRight<br>
<br>
version is 1.0.12 with slf4j 1.7.5<br>
<br>
<br>
<br>
Help is much appreciated ;)<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Cheers,<br>
Yoni<br>
</font></span></blockquote></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
-- <br>
Ceki<br>
65% of statistics are made up on the spot<br>
______________________________<u></u>_________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/<u></u>listinfo/logback-user</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Cheers,<div>Yoni</div></div>
</div>