<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
This question should belong to Java threads rather than logback.
Anyways, try tomcat.properties -> common.dir<br>
<br>
-Amot<br>
<div class="moz-cite-prefix">On 11/4/2012 2:04 PM, Gaurav Kumar
wrote:<br>
</div>
<blockquote
cite="mid:CAPc-p7nOPZHrKzq_kfbEVS=8RZB1tqso2LwA7hJR3MfSRiG-kQ@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<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
moz-do-not-send="true" href="mailto:gaurav419@gmail.com">gaurav419@gmail.com</a>
<span dir="ltr"><<a moz-do-not-send="true"
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 class="HOEnZb">
<div class="h5"><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
moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:Logback-user@qos.ch"
target="_blank">Logback-user@qos.ch</a><br>
<a moz-do-not-send="true"
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 class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Logback-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a>
<a class="moz-txt-link-freetext" href="http://mailman.qos.ch/mailman/listinfo/logback-user">http://mailman.qos.ch/mailman/listinfo/logback-user</a></pre>
</blockquote>
<br>
</body>
</html>