<div dir="ltr">Hi Amot,<br>My question was very specific to Jetty, and the jars in discussion are the logback jars, which when placed in jetty/lib/etc is also picked by jetty during its startup (I dont want jetty to pick it during its startup but would want the webapps to see it). So this is posted here. <br>

My intent was to place these jars at a common location in Jetty and let the web containers be aware of it.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 5, 2012 at 12:37 AM, Amit Mohan <span dir="ltr"><<a href="mailto:amit.mohan@teamaol.com" target="_blank">amit.mohan@teamaol.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    This question should belong to Java threads rather than logback.
    Anyways, try tomcat.properties -> common.dir<br>
    <br>
    -Amot<div><div class="h5"><br>
    <div>On 11/4/2012 2:04 PM, Gaurav Kumar
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Any recommendations on where to place common jars
        used by all web applications in webapps dir but which will not
        be picked by jetty during its startup? also how to set this
        classpath in the web container?<br>
        Any help will be really appreciated.<br>
        <br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Thu, Nov 1, 2012 at 3:24 AM, <a href="mailto:gaurav419@gmail.com" target="_blank">gaurav419@gmail.com</a>
          <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>
              <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>
            </div>
            <div>
              <div><br>
                <br>
                Ralph Goers wrote:<br>
                <br>
                <div>
                  <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>
                    <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>
                                    <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>
                                  <div><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><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><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><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>
                                  </div>
                                  <p><br>
                                  </p>
                                  <p><b>LogbackLogTriggeringPolicy.java
                                      is:</b></p>
                                  <div><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><i>
                                                isTriggeringEvent(null,
                                      null);<br>
                                                try {<br>
                                                    tbrp.rollover();<br>
                                                } catch (RolloverFailure
                                      e) {<br>
                                                    //Do nothing<br>
                                                }<br>
                                            }<br>
                                      }<br>
                                    </i></div>
                                  <div><br>
                                  </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" 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/listinfo/logback-user</a></blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Logback-user mailing list
<a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a></pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>