[logback-user] Max history for size and daily failing
Fabiano, Lucas
Lucas.Fabiano at br.experian.com
Fri Apr 3 15:34:13 CEST 2015
Hi everyone,
I’m using the configuration below for the appender. What I want to do is rollout the file after reach a size or in a daily bases.
My problem is regarding how many files I want to have. I use the maxHistory and it works well for daily log and remove the old ones.
The problem is when the file achieve the maximum size for it in the same day. It creates a new file with the index number on the file name but I can’t control how many files I can have.
I tried to use the max and min index it inside timeBasedFileNamingAndTriggeringPolicy tag but when the config load it shows na error saying the configuration is in the wrong place.
Even if I put the maxhistory inside this tag it shows the same problem and don’t rollout by size.
<appender name="APPLICATION" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${destination}/${contextName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- separa o arquivo de log diariamente -->
<fileNamePattern>${destination}/${contextName}-%d{yyyyMMdd}.%i.log.zip</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- ou sempre que o arquivo alcancar 100Mb -->
<maxFileSize>1MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>2</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date{yyyyMMdd|HHmmss.SSS}|%-5level|%10X{tid}|%logger{0}:%line|%msg%n</pattern>
</encoder>
</appender>
Any advice will be welcome.
Thank you!
Lucas
________________________________
This email and any attachments are for the exclusive and confidential use of the named intended recipient(s) and may be legally privileged. Any review, re-transmission, dissemination or any other use of its contents, or taking of any action in reliance upon this information by persons and/or entities other than the named intended recipient(s) is strictly prohibited. If you have received this communication in error, please send this communication back to the sender, disregard its contents, and promptly delete the original message and any copy of it from your computer systems. The misuse of this message will be dealt according to company rules and current legislation. This message expresses the sender’s point of view about the topics described and not necessarily expresses Serasa Experian’s opinion about them.
As informações contidas nesta mensagem e no(s) arquivo(s) anexo(s) são endereçadas exclusivamente à(s) pessoa(s) e/ou instituição(ões) acima indicada(s), e podem conter dados confidenciais. É expressamente proibido a pessoas não autorizadas, sob qualquer forma ou pretexto, utilizá-las, divulgá-las, alterá-las, de forma impressa ou copiada, total ou parcialmente. Caso tenha recebido esta mensagem erroneamente, por favor, notifique o remetente e providencie imediata exclusão da original e de qualquer cópia. O uso impróprio será tratado conforme as normas da empresa e da legislação em vigor. Esta mensagem expressa o posicionamento pessoal do subscritor e não reflete necessariamente a opinião da Serasa Experian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20150403/5ae207ed/attachment.html>
More information about the Logback-user
mailing list