<div dir="ltr">Hi Ceki,<div><br></div><div style>ouch, I didn't notice that debug flag! Just copied the configuration file from the real application we use... Nevertheless, when I changed it, redeployed and tested again, the only thing I can see in the server's log is:</div>
<div style><br></div><div style><div>13:03:47,487 |-INFO in ch.qos.logback.classic.jmx.JMXConfigurator(TST-LOGBACK) - onReset() method called JMXActivator [ch.qos.logback.classic:Name=TST-LOGBACK,Type=ch.qos.logback.classic.jmx.JMXConfigurator]</div>
<div><br></div><div style>When I (re)deploy the app, I can see (as expected) a lot of statements from Logback during its initialization. However, when I stop/start the application, nothing like that happens. Looks like logback is not reinitializing in such case.</div>
<div style><br></div><div style>Thank you.</div><div style><br></div><div style>Best regards,</div><div style>rox</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 17, 2013 at 11:59 AM, 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">It very much helps to set <configuration debug="true"> when diagnosing logback-related problems. If debug="true" logback might actually tell you why it stops logging after app restart. I suspect that the underlying issue is caused by jmxConfigurator which probably throws an exception the second time it is started in your particular environment.<div>
<div class="h5"><br>
<br>
<br>
<br>
On 17.04.2013 11:45, Roxolid wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi Ceki,<br>
<br>
first of all, here is my configuration file, I'm copy-pasting it as we<br>
have (is almost identical to the one from all applications we develop now):<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<configuration debug="false"><br>
<contextName>TST-LOGBACK</<u></u>contextName><br>
<jmxConfigurator/><br>
<br>
<turboFilter class="ch.qos.logback.classic.<u></u>turbo.MarkerFilter"><br>
<Marker>PROFILER</Marker><br>
<OnMatch>ACCEPT</OnMatch><br>
</turboFilter><br>
<br>
<property name="AUDIT_LOG_DIR" value="/export/home/oracle/<u></u>TESTS/tst" /><br>
<property name="AUDIT_LOG_FILE" value="tst-logback-audit.log" /><br>
<property name="PERF_LOG_DIR" value="/export/home/oracle/<u></u>TESTS/tst" /><br>
<property name="PERF_LOG_FILE" value="tst-logback-perf.log" /><br>
<property name="LOG_DIR" value="/export/home/oracle/<u></u>TESTS/tst" /><br>
<property name="LOG_FILE" value="tst-logback.log" /><br>
<property name="LOG_FILE_ROLLING" value="tst-logback" /><br>
<br>
<appender name="FILE"<br>
class="ch.qos.logback.core.<u></u>rolling.RollingFileAppender"><br>
<prudent>true</prudent><br>
<rollingPolicy<br>
class="ch.qos.logback.core.<u></u>rolling.<u></u>TimeBasedRollingPolicy"><br>
<!-- daily rollover with<br>
${LOG_DIR}/${LOG_FILE_ROLLING}<u></u>_%d{yyyy-MM-dd}.log --><br>
<!-- hourly rollover with<br>
${LOG_DIR}/${LOG_FILE_ROLLING}<u></u>_%d{yyyy-MM-dd_HH}.log --><br>
<!-- every minute rollover with<br>
${LOG_DIR}/${LOG_FILE_ROLLING}<u></u>_%d{yyyy-MM-dd_HH_mm}.log --><br>
<br>
<fileNamePattern>${LOG_DIR}/${<u></u>LOG_FILE_ROLLING}_%d{yyyy-MM-<u></u>dd_HH}.log</fileNamePattern><br>
<!-- keep 30 days' worth of history --><br>
<maxHistory>48</maxHistory><br>
</rollingPolicy><br>
<encoder><br>
<pattern>%date %level [%thread] %logger{10} [%file:%line]<br>
%msg%n</pattern><br>
</encoder><br>
</appender><br>
<br>
<appender name="AUDIT_FILE" class="ch.qos.logback.core.<u></u>FileAppender"><br>
<file>${AUDIT_LOG_DIR}/${<u></u>AUDIT_LOG_FILE}</file><br>
<encoder><br>
<pattern>%date %level %logger{10} %msg%n</pattern><br>
</encoder><br>
</appender><br>
<br>
<appender name="PERF_FILE" class="ch.qos.logback.core.<u></u>FileAppender"><br>
<file>${PERF_LOG_DIR}/${PERF_<u></u>LOG_FILE}</file><br>
<encoder><br>
<pattern>%date [%thread] %logger{10} %msg%n</pattern><br>
</encoder><br>
</appender><br>
<br>
<appender name="STDOUT" class="ch.qos.logback.core.<u></u>ConsoleAppender"><br>
<encoder><br>
<pattern>%date %level [%file:%line] %msg</pattern><br>
</encoder><br>
</appender><br>
<br>
<logger name="com.oracle.sk.tst" level="trace" additivity="false"><br>
<appender-ref ref="FILE" /><br>
</logger><br>
<br>
<logger name="com.oracle.sk.tst.<u></u>logback.TestLogbackServlet"<br>
level="info" additivity="false"><br>
<appender-ref ref="FILE" /><br>
</logger><br>
<br>
<logger name="AUDITOR" level="trace" additivity="false"><br>
<appender-ref ref="AUDIT_FILE" /><br>
</logger><br>
<br>
<logger name="PROFILER" level="debug" additivity="false"><br>
<appender-ref ref="PERF_FILE" /><br>
</logger><br>
<br>
<root level="OFF"><br>
<appender-ref ref="FILE" /><br>
</root><br>
</configuration><br>
<br>
The prudent flag is there because I had troubles with truncating log<br>
files by our test people. They use "cat /dev/null/ ><br>
tst-logback_2013-04-17_10.log" to clear the log when they start testing.<br>
Without "prudent", application was not able to recover from it and was<br>
not logging anymore.<br>
<br>
Maybe you want to look at complete testing project I use for solving<br>
this issue. I try to attach it to this email (don't know if attachments<br>
are allowed for this mailing list). And if you wish I can provide you<br>
with small (~2 min, ~13MB, FLV) video demostrating the behavior.<br>
<br>
I did further testing and found one thing - after stopping and starting<br>
the app it was not able to recover even after rollover (on my dev<br>
machine with the testing project). The report from testing team says<br>
that they've seen it recovers when the new log file was rolled out,<br>
however now no one can remember if really :-) So I consider this as<br>
"not, it didn't recover" - at least I'm not able to prove that.<br>
<br>
So after all, when I stop/start the app, it will stop logging...<br>
<br>
Thank you for your help, I really appreciate it.<br>
<br>
Regards,<br>
rox<br>
<br>
P.S.: BTW, even it has no impact to this issue, just for interest's<br>
sake, I think I found why I had lc.reset() in my code - in<br>
documentation, the example uses stop(), however the text above mentions<br>
reset().<br>
<br>
<br>
<br></div></div>
On Tue, Apr 16, 2013 at 5:31 PM, ceki <<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a> <mailto:<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a>>><div class="im"><br>
wrote:<br>
<br>
<br>
LoggerContext.close() is almost identical to<br>
LoggerContext.reset(). Here is the code:<br>
<br>
class LoggerContext ... {<br>
<br>
public void stop() {<br>
reset();<br>
fireOnStop();<br>
resetAllListeners();<br>
started = false;<br>
}<br>
}<br>
<br>
I don't think calling reset or close should make a difference. You<br>
want to release and close appenders which reset() does. Could you<br>
post your configuration file?<br>
<br>
<br>
On 16.04.2013 16:59, Roxolid wrote:<br>
<br>
Hi Ceki,<br>
<br>
well, half-true in my case... I have that code in my<br>
contextDestroyed(..) method, however, for whatever reason I have<br>
lc.reset() instead of lc.stop there... Will change and test that<br>
once<br>
I'm back to my dev machine. I will let you know then.<br>
<br>
Thank you for your help.<br>
<br>
Regards,<br>
rox<br>
<br>
<br>
<br>
On Tue, Apr 16, 2013 at 4:01 PM, ceki <<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a><br></div>
<mailto:<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a>> <mailto:<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a> <mailto:<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a>>>><div class="im">
<br>
<br>
wrote:<br>
<br>
Hi Rox,<br>
<br>
Are you stopping logback when your application is stopped<br>
(and then<br>
started)? The conextDestroyed method of<br></div>
javax.servlet.____<u></u>ServletContextListener is a good place<br>
for invoking<br>
such code:<br>
<br>
import javax.servlet.____<u></u>ServletContextListener;<br>
import javax.servlet.____<u></u>ServletContextEvent;<br>
import org.slf4j.LoggerFactory;<br>
import ch.qos.logback.classic.____<u></u>LoggerContext;<div class="im"><br>
<br>
<br>
public class MyServletContextListener implements<br>
ServletContextListener {<br>
<br></div>
public void contextInitialized(____<u></u>ServletContextEvent<br>
sce) {<br>
}<br>
<br>
public void contextDestroyed(____<u></u>ServletContextEvent sce) {<br>
LoggerContext lc =<br>
(LoggerContext)<br>
LoggerFactory.____<u></u>getILoggerFactory();<div><div class="h5"><br>
<br>
lc.stop();<br>
}<br>
<br>
Please let us know if stopping logback as described above<br>
helps.<br>
<br>
<br>
On 16.04.2013 15:06, Roxolid wrote:<br>
<br>
Hi all,<br>
<br>
I have a trouble with logback configuration under<br>
WebLogic 12c. My<br>
application is using RollingFile Appender with<br>
TimeBasedRollingPolicy<br>
and the problem is it stops logging every time I stop<br>
and then<br>
start the<br>
application through WebLogic Console. However, the<br>
logging is<br>
back when<br>
a rollover occurs - in the new file logging continues...<br>
<br>
Has anyone faced such behavior (and knows the solution)?<br>
<br>
Thank you in advance.<br>
<br>
Regards,<br>
<br>
rox<br>
<br>
<br>
<br>
</div></div></blockquote><div class="HOEnZb"><div class="h5">
<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>
</div></div></blockquote></div><br></div>