[logback-user] Log Rotation Fails on Windows if Using JNDI
Scott Dudley
scott at telesoft.com
Thu Nov 3 21:37:57 CET 2011
My understanding from the documentation was that prudent was only
relevant when multiple JVM's were writing to the same log. I have only
one. I also read that it's use (although sometimes a necessity) incurs
a 3X drop in speed.
On 11/03/2011 01:29 PM, ceki wrote:
>
> Sorry, I skipped the class loader part of the problem. In any case,
> you should really enable prudent mode if you don't want to have
> garbage in the shared log file.
>
> On 03/11/2011 9:16 PM, Scott Dudley wrote:
>>
>> Ceki,
>>
>> It looks like this will only work if each application loads it's own
>> copy of the logback classes. If so, this is not the case. Like I said in
>> my original post, we have to place them at the highest level classloader
>> (Tomcat's lib) so there's only one.
>>
>>
>> On 11/03/2011 11:58 AM, ceki wrote:
>>> On 03/11/2011 7:39 PM, Scott Dudley wrote:
>>>>
>>>> There are two applications running under one Tomcat instance and yes,
>>>> Tomcat also logs via the same file and configuration.
>>>>
>>>> Yes, I read the link in the error but there was nothing applicable
>>>> to my
>>>> specific configuration/scenario.
>>>>
>>>> Like I said, it does exactly what we want on Linux but log rotation
>>>> fails on Windows. If I disable JNDI, log rotation works but then I
>>>> lose
>>>> context identification (application name) which is likewise critical.
>>>
>>> Linux is less picky about renaming files with open handles. However,
>>> this does not mean that your log files are not being clobbered under
>>> Linux. You should probably enable prudent mode [1].
>>>
>>> It seems that you are ignoring my remarks about setting the context
>>> name within the config file. It's OK as ContextJNDISelector provides
>>> an alternative solution although ContextJNDISelector is an overkill if
>>> you are going to share the same configuration file.
>>>
>>> [1] http://logback.qos.ch/manual/appenders.html#prudent
>>>
>>>>
>>>> On 11/03/2011 11:06 AM, ceki wrote:
>>>>> Hi Scott,
>>>>>
>>>>> I presume you have already read the link provided in the error:
>>>>>
>>>>> http://logback.qos.ch/codes.html#renamingError
>>>>>
>>>>> Which applications write to apache-tomcat-6.0.24\logs\debug.log? Does
>>>>> Tomcat write there too?
>>>>>
>>>>> Did you know that you can specify the context name in the logback
>>>>> configuration file? You can also have a configuraion file per
>>>>> application which than share a configuration file via inclusion.
>>>>>
>>>>> Here is an example:
>>>>>
>>>>> For application A:
>>>>>
>>>>> <configuration>
>>>>> <statusListener
>>>>> class="ch.qos.logback.core.status.OnConsoleStatusListener" />
>>>>> <contextName>appA</contextName>
>>>>> <include file="c:/foo/shared-logback.xml"/>
>>>>> </configuration>
>>>>>
>>>>> For application B:
>>>>>
>>>>> <configuration>
>>>>> <statusListener
>>>>> class="ch.qos.logback.core.status.OnConsoleStatusListener" />
>>>>> <contextName>appB</contextName>
>>>>> <include file="c:/foo/shared-logback.xml"/>
>>>>> </configuration>
>>>>>
>>>>> shared-logback.xml
>>>>>
>>>>> <included>
>>>>> <appender name="FILE"
>>>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>>> <file>${catalina.home}/logs/debug.log</file>
>>>>>
>>>>> <rollingPolicy ....
>>>>> </appender>
>>>>>
>>>>> <root level="DEBUG">
>>>>> <appender-ref ref="FILE" />
>>>>> </root>
>>>>> </included>
>>>>>
>>>>> HTH,
>>>>
>>
>
>
--
Scott Dudley
Senior Developer
Telesoft Corp. | 1661 E. Camelback Rd., Suite 300 | Phoenix, AZ, 85016
*o:* (602) 308-1115**| *f:* (602) 308-1300 | *w:* www.telesoft.com
<http://www.telesoft.com>
*TEM Edge Blog <http://www.telesoft.com/blog> *|*Twitter
<http://www.twitter.com/_Telesoft> *|*Facebook
<http://www.facebook.com/pages/Telesoft-Corp/76397971661>Join us at
Telesoft Connections 2011. Learn more now!
<http://www.telesoftconference.com>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20111103/97fc2096/attachment.html>
More information about the Logback-user
mailing list