I really don't see how what you have configured can work. You have multiple 
appenders all referencing the same file. After the first log event occurs in 
each appender after midnight they should each try to roll over.  In thinking 
about this and looking at the code I'm just not sure what might happen, but I 
don't think it will be good. Perhaps I am missing something since this is also 
supposed to work with prudent mode, which I would think would have the same 
results just across JVMs instead of this way.

I would suggest you get the status log messages and see what is happening 
during the rollover.

Ralph

On Mar 15, 2011, at 7:10 AM, Pradnya Gawade wrote:

> Hi David,
> 
> Thanks for the reply. I did not try with the latest version and will
> update once I do it. But as I mentioned it used work with the same
> logback version before my logging configuration was simpler.
> 
> Thanks,
> Pradnya
> 
> 
> 
> 
> 
> On Tue, Mar 15, 2011 at 3:41 AM, David Roussel
> <[email protected]> wrote:
>> Does using the latest version fix it?
>> 
>> On 10 Mar 2011, at 20:45, Pradnya Gawade <[email protected]> wrote:
>> 
>>> Hi,
>>> 
>>> I am trying with this for a long time but could not figure out the problem.
>>> My web application has to log to a log file but we want different
>>> category tags to be assigned to the logs from specific packages,
>>> although all log will go to the same physical log file. I create one
>>> appender per category with the required tag included in the encoder
>>> pattern. I have crated a filter per appender so it will only take the
>>> logs for that category and reject all other logs.Then I map the parent
>>> package of my web application source code with all the appenders that
>>> I have created for each category. I know this sounds complicated
>>> please bear with me. The category mapping I get in the logging is fine
>>> and as expected but I am facing other unexpected issue of files
>>> rolling over. I am using daily rollover policy. File gets rolled over
>>> properly but the current log file contains a copy of logs from
>>> archived file with new logs appended to it. I don't understand why it
>>> happens.
>>> I use o.9.20 version of logback. File rollover used to work fine
>>> before I categorized the log and when all the logs simply used to go
>>> to the same file without any category tagging associated.
>>> Please suggest what could be going wrong if you can think of some
>>> thing. Thanks in advance.
>>> 
>>> My logback.xml looks like:
>>> 
>>> <!-- appender for category LPR -->
>>>    <appender name="LOGFILE-LPR"
>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>        <filter class="abc.log.LogFilterFacilityLPR"/>
>>>        <file>${log.dir}.log</file>
>>>        <rollingPolicy 
>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>            <!-- daily rollover -->
>>>            <fileNamePattern>${log.dir}.%d{yyyy-MM-dd}.log</fileNamePattern>
>>>            <!-- keep 30 days' worth of history -->
>>>            <maxHistory>30</maxHistory>
>>>        </rollingPolicy>
>>>        <encoder>
>>>            <pattern>%date{MM/dd HH:mm:ss} [%mdc{WEBAPP}] LPR %-5level
>>> %logger{25}:%L - %msg %n %ex{full}</pattern>
>>>        </encoder>
>>>    </appender>
>>>    <!-- appender for category USER -->
>>>    <appender name="LOGFILE-USER"
>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>        <filter class="abc.log.LogFilterFacilityUSER"/>
>>>        <file>${log.dir}.log</file>
>>>        <rollingPolicy 
>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>            <!-- daily rollover -->
>>>            <fileNamePattern>${log.dir}.%d{yyyy-MM-dd}.log</fileNamePattern>
>>>            <!-- keep 30 days' worth of history -->
>>>            <maxHistory>30</maxHistory>
>>>        </rollingPolicy>
>>>        <encoder>
>>>            <pattern>%date{MM/dd HH:mm:ss} [%mdc{WEBAPP}] USER %-5level
>>> %logger{25}:%L - %msg %n %ex{full}</pattern>
>>>        </encoder>
>>>    </appender>
>>> .
>>> .
>>> .
>>> .
>>> <!-- logger for parent package -->
>>> <logger additivity="false" name="org.akaza.openclinica">
>>>        <level value="${logLevel}" />
>>>        <appender-ref ref="LOGFILE-OTHER"/>
>>>        <appender-ref ref="LOGFILE-LPR"/>
>>>        <appender-ref ref="LOGFILE-USER"/>
>>>        <appender-ref ref="LOGFILE-MAIL"/>
>>>        <appender-ref ref="LOGFILE-AUTH"/>
>>>        <appender-ref ref="LOGFILE-UUCP"/>
>>>        <appender-ref ref="LOGFILE-AUTHPRIV"/>
>>> </logger>
>>> _______________________________________________
>>> Logback-user mailing list
>>> [email protected]
>>> http://qos.ch/mailman/listinfo/logback-user
>> _______________________________________________
>> Logback-user mailing list
>> [email protected]
>> http://qos.ch/mailman/listinfo/logback-user
>> 
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://qos.ch/mailman/listinfo/logback-user

_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user

Reply via email to