<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hello,<BR><BR>How can&nbsp;i set&nbsp;the log filename set during the init() of&nbsp;my StartupServlet.<BR></DIV>
<DIV>I tried using MDC but it's not working for me.</DIV>
<DIV><BR>What happens is the file is not created. Instead a file with name "%exp{logFileName}" is created on my web server's bin directory.<BR><BR>In my StartupServlet, I have this init method that calls MDC.put().<BR><BR>public void init() throws ServletException {<BR>MDC.put("logFileName", "c:\\testlogs\\test.log");<BR>Logger log = LoggerFactory.getLogger(StartupServlet.class); <BR>log.info("This should be logged");<BR>}<BR><BR>In my logback.xml, I have a MDC.get().<BR><BR>&lt;appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;<BR>&lt;append&gt;true&lt;/append&gt;<BR>&lt;expression name="logFileName"&gt;MDC.get("logFileName")&lt;/expression&gt;<BR>&lt;file&gt;%exp{logFileName}&lt;/file&gt;<BR>...<BR><BR>I'm new with logback, thanks in advance for your help! I'm trying to follow Ceki's example in his blog</DIV>
<DIV><A href="http://ceki.blogspot.com/2006/10/repated-configuration-with-joran.html">http://ceki.blogspot.com/2006/10/repated-configuration-with-joran.html</A><BR><BR>thanks,<BR>jenny</DIV></td></tr></table><br>