logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Schöning <tschoen...@am-soft.de>
Subject Re: Question regarding the technical details of a log rollover
Date Wed, 21 May 2014 19:33:17 GMT
Guten Tag Lucas Vickers,
am Mittwoch, 21. Mai 2014 um 19:56 schrieben Sie:

> I'm pretty sure the answer is that it must be actively logging, and
> that does in fact make sense since I doubt you are trying to
> actively parse log files.

No we don't, but the more interesting question is if the app hast to
log shortly after midnight to rollover or if hours after midnight is
enough if it's the first log statement. But I don't know the answer.
;-)

> So I guess the question is how do I set
> the daily rollover to happen at a certain hour, rather than at midnight?

I don't think you can't.

http://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1_daily_rolling_file_appender.html

What about a different approach? This way you are not tied to logging
occurring shortly after midnight, but need to take care about unneeded
files on your own.

        <appender       name="monthSpecificLogFile"
                                class="org.apache.log4j.rolling.RollingFileAppender">
                <rollingPolicy  class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
                        <param  name="FileNamePattern"
                                        value="..\..\..\Datenserver\Logdateien\dbxml\dbxml\${mandant}\%d{yyyy-MM}.log"
                        />
                </rollingPolicy>
                <layout class="org.apache.log4j.PatternLayout">
                        <param  name="ConversionPattern"
                                        value="%d{yyyy-MM-dd HH:mm:ss,SSS} %p> %c.%M: %m%n"
                        />
                </layout>
                <param  name="append"
                                value="true"
                />
        </appender>

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail:Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


Mime
View raw message