<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><div>What do you suggest would be a good location to place these jars in Jetty? I tried to put them into jetty/lib/etc but then jetty loads it up during jetty startup and creates other unwanted side effects. Is there a good place to locate these jars so jetty doesnt load them at its startup and only the wars from webapps location could pick them?</div><div><br></div> </body></html><br><br>Ralph Goers <rgoers@apache.org> wrote:<br><br><body><div>With each application having its own copy of slf4j and logback you are making it so each web app will have to have its own appenders writing to the file.  While Logback supports using prudent mode for this, I don't recommend it.  Instead, I would suggest that you move logback and slf4j out of the web apps an add them to a common classpath and then have them share the logging configuration. With that you should have no problem having multiple web apps write to the same file.</div><div><br></div><br><div><div>On Oct 31, 2012, at 5:56 AM, Gaurav Kumar wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">any suggestions will be really appreciated. I am totally stuck on this.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 30, 2012 at 11:39 PM, Gaurav Kumar <span dir="ltr"><<a href="mailto:gaurav419@gmail.com" target="_blank">gaurav419@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<br><div class="gmail_quote"><div dir="ltr"><p>[Please ignore the previous email with the same subject line. That was accidentally posted.]<br>


</p><div class="im"><p><br></p><p>I am using Jetty webserver and logback for logging.</p><p><br>
I have a scenario with multiple Web Applications (so multiple wars into jetty/webapps dir). Each war has its own copy of logback-classic, logback-core and slf4j-api. There is a common copy of logback.xml in jetty/resources (pasted below). My intent is to maintain a logfile named "testapp.<date>.log" which should be used by all the wars for logging. Further, I want a rollover of this file on every startup. I am able to achieve this except that each war is trying to create its own version of the log file so when each war is loaded it creates its own logfile archiving the earlier logfile created by the earlier war. This continues till all wars are loaded thus creating these many log files per startup. The archived files are are named "testapp.<date>.log.<time in millisec>.<br>



</p><p>Is there a way to ask all wars to log into the same file?</p><p><br></p><p><u><b>logback.xml file content:</b></u></p></div><p><i></i></p><div class="im"><i><configuration><br>  <timestamp key="dateStr" datePattern="yyyy-MM-dd" timeReference="contextBirth"/>--><br>



  <timestamp key="timeStr" datePattern="HHmmssSSS" timeReference="contextBirth"/>--><br><br>  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"><br>



    <encoder><br>       <pattern>%date{MMM dd}, %date{yyyy hh:mm:ss a} %class %method\(\):%line %n%level: %message%n </pattern><br>    </encoder><br>  </appender><br> <br>  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"><br>

</i></div><i>

    <file>${jetty.home}/logs/testapp.${dateStr}.log</file><div class="im"><br><br>    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><br>      <!-- daily rollover --><br>

</div>      <fileNamePattern>${jetty.home}/logs/testapp.%d{yyyy-MM-dd}.log.${timeStr}</fileNamePattern><div class="im"><br>

 <br>      <!-- keep max 30 rolled over files --><br>      <maxHistory>30</maxHistory><br>      <cleanHistoryOnStart>true</cleanHistoryOnStart><br><br></div>      <!-- trigger for daily rollover and every server restart --><br>



      <timeBasedFileNamingAndTriggeringPolicy class="utils.<b>LogbackLogTriggeringPolicy</b>"/><div class="im"><br>    </rollingPolicy><br><br>    <encoder><br>        <pattern>%date{MMM dd}, %date{yyyy hh:mm:ss a} %class %method\(\):%line %n%level: %message%n </pattern><br>



    </encoder><br>  </appender><br> <br>  <root level="INFO"><br>    <appender-ref ref="FILE" /><br>  </root><br></configuration></div></i><div><br class="webkit-block-placeholder"></div><p><br></p><p><b>LogbackLogTriggeringPolicy.java is:</b></p><p><i></i></p><div class="im"><i>@NoAutoStart<br>public class LogbackLogTriggeringPolicy<E> extends DefaultTimeBasedFileNamingAndTriggeringPolicy<E> {<br>  @Override<br>      public void start() {<br>          super.start();<br>

          nextCheck = 0L;<br></i></div><div class="im"><i>

          isTriggeringEvent(null, null);<br>          try {<br>              tbrp.rollover();<br>          } catch (RolloverFailure e) {<br>              //Do nothing<br>          }<br>
      }<br>}<br></i></div><div><br class="webkit-block-placeholder"></div><p>Thanks.<br></p>
</div>
</div><br></div>
</blockquote></div><br></div>
_______________________________________________<br>Logback-user mailing list<br><a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>http://mailman.qos.ch/mailman/listinfo/logback-user</blockquote></div><br> </body>