[logback-user] Logback configuration

Neha Kothari neha.kothari at db.com
Wed Apr 6 18:06:21 CEST 2011


Thanks Raman. 

I read somewhere that maxHistory depends on the roll-over type. So if I 
have something like this
<fileNamePattern>test.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
 <maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy 
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
 </timeBasedFileNamingAndTriggeringPolicy>

which means daily roll-over and maxHistory signifies that it will keep it 
for 10 days. So that is where I'm facing a problem, as putting a number in 
maxHistory signifies the number of days it will keep the history for and 
not the maximum number for files per day. 

I also have a case like the following

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>test.log.%d{yyyy-MM}.%i</fileNamePattern>
        <maxHistory>1</maxHistory>
        <timeBasedFileNamingAndTriggeringPolicy 
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                        <maxFileSize>10MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
 </rollingPolicy>

When mentioning the value 1 in maxHistory I assume it means saving it for 
a month. So its going to save all test.log.2011-03.0, 
test.log.2011-03.1,test.log.2011-03.2,......... Once it reaches may all 
files for the month or 03 will be deleted and instead we will have those 
for 04. Correct me If I'm not thinking right?







"Raman, Kalyan" <Kalyan.Raman at morganstanley.com> 
Sent by: logback-user-bounces at qos.ch
04/06/2011 09:37 AM
Please respond to
logback users list <logback-user at qos.ch>


To
"logback users list" <logback-user at qos.ch>
cc

Subject
Re: [logback-user] Logback configuration






Hi Neha,
                The maxHistory denotes the number of history files that 
are maintained. So if you want a cap of the index to be say 10, configure 
the maxHistory to 10 like shown below, which results in the max index of 
the history files will be 10.
In your case it will be test.log.2011-04-06.10
 
Thanks,
Kalyan
 
From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On 
Behalf Of Neha Kothari
Sent: Wednesday, April 06, 2011 9:27 AM
To: logback users list
Subject: Re: [logback-user] Logback configuration
 

The max history is for setting the limit on the file size. I want to set a 
cap on the index i appended.



Clemens Siebler <clemens.siebler at googlemail.com> 
Sent by: logback-user-bounces at qos.ch 
04/06/2011 05:08 AM 


Please respond to
logback users list <logback-user at qos.ch>



To
logback users list <logback-user at qos.ch> 
cc

Subject
Re: [logback-user] Logback configuration
 








Should be possible using the maxHistory parameter:

    <appender name="file" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>test.log</File>
        <encoder>
            <pattern>... </pattern>
        </encoder>
        <rollingPolicy 
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>test.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
            <maxHistory>10</maxHistory>
            <timeBasedFileNamingAndTriggeringPolicy 
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>10MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
    </appender>

On Tue, Apr 5, 2011 at 10:22 PM, Neha Kothari <neha.kothari at db.com> wrote: 


Hi have started to use logback for logging in java. I am using 
"TimeBasedRollingPolicy" rolling policy as I wanted dated logs. 

My file pattern looks like c:/spg-live.%d{yyyy-MM-dd}.%i.log 
Is there a way that I can put a maxIndex (i.e the maximum limit for i) 
using the same rolling policy? 

Thanks 


---
This communication may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this communication
in error) please notify the sender immediately and destroy this
communication. Any unauthorized copying, disclosure or distribution of the
material in this communication is strictly forbidden.

Deutsche Bank does not render legal or tax advice, and the information
contained in this communication should not be regarded as such.
_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://qos.ch/mailman/listinfo/logback-user

_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://qos.ch/mailman/listinfo/logback-user


---
This communication may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this communication
in error) please notify the sender immediately and destroy this
communication. Any unauthorized copying, disclosure or distribution of the
material in this communication is strictly forbidden.

Deutsche Bank does not render legal or tax advice, and the information
contained in this communication should not be regarded as such.

NOTICE: Morgan Stanley is not acting as a municipal advisor and the 
opinions or views contained herein are not intended to be, and do not 
constitute, advice within the meaning of Section 975 of the Dodd-Frank 
Wall Street Reform and Consumer Protection Act. If you have received this 
communication in error, please destroy all electronic and paper copies and 
notify the sender immediately. Mistransmission is not intended to waive 
confidentiality or privilege. Morgan Stanley reserves the right, to the 
extent permitted under applicable law, to monitor electronic 
communications. This message is subject to terms available at the 
following link: http://www.morganstanley.com/disclaimers. If you cannot 
access these links, please notify us by reply message and we will send the 
contents to you. By messaging with Morgan Stanley you consent to the 
foregoing._______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://qos.ch/mailman/listinfo/logback-user



---
This communication may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this communication
in error) please notify the sender immediately and destroy this
communication. Any unauthorized copying, disclosure or distribution of the
material in this communication is strictly forbidden.

Deutsche Bank does not render legal or tax advice, and the information
contained in this communication should not be regarded as such.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20110406/20717306/attachment.html>


More information about the Logback-user mailing list