Hi,
we've configured our karaf.log to rollover every day at midnight:
log4j.appender.out=org.apache.log4j.DailyRollingFileAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.datePattern='.'yyyy-MM-dd
log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t |
%-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
log4j.appender.out.file=${karaf.data}/log/karaf.log
But when we shutdown Karaf before midnight and restart it the next day, the
expected rollover does not work.
Digging the code shows that the DailyRollingFileAppender uses the last modify
time to decide if a rollover should happen.
But at the very early start of the Karaf container seems to touch the log file
and/or writes five or six lines into it before the appender
configuration is read, so the modify time changes and the rollover is skipped.
Any hints or a workaround how to solve this problem? I really want to get a new
file every day, independent of container restarts.
TIA & Regards,
Volker
CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax:
+49 711 7825-4000, Internet: www.cenit.com
Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen, Oelsnitz,
Ratingen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats),
Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00
SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155
00 SWIFT-Code : COBADEFF600,
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777