logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baron Fujimoto <ba...@hawaii.edu>
Subject confused by log4j2 Rolling File Appender
Date Fri, 28 Oct 2016 02:37:27 GMT
I'm trying to configure I'm trying to configure an application (Apereo's CAS 5)
to roll its log files daily. This is an excerpt from its log4j2.xml config file
based on the the log4j2 documentation here

<https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender>

    <RollingFile name="file" fileName="/path/to/cas/logs/cas.log" append="true"
                 filePattern="/path/to/cas/logs/cas.log.%d{yyyy-MM-dd}">
        <PatternLayout pattern="%d %p [%c] - &lt;%m&gt;%n"/>
        <Policies>
            <OnStartupTriggeringPolicy />
            <SizeBasedTriggeringPolicy />
            <TimeBasedTriggeringPolicy interval="1" modulate="true" />
        </Policies>
    </RollingFile>

But when CAS starts up, I see the following:

2016-10-27 17:32:02,461 localhost-startStop-1 ERROR Unable to move file /path/to/cas/logs/cas.log.2016-10-27
to /path/to/cas/logs/cas.log.2016-10-27: java.nio.file.NoSuchFile Exception /path/to/cas/logs/cas.log.2016-10-27
-> /path/to/cas/logs/cas.log.2016-10-27
2016-10-27 17:32:02,464 localhost-startStop-1 ERROR Unable to copy file /path/to/cas/logs/cas.log.2016-10-27
to /path/to/cas/logs/cas.log.2016-10-27: java.nio.file.NoSuchFile Exception /path/to/cas/logs/cas.log.2016-10-27

I don't understand

1) why it's trying to move (and copy?) cas.log.2016-10-10 to
cas.log.2016-10-10

2) why the NoSuchFileException when
$ ls -go /path/to/cas/logs/cas.log.2016-10-10
-rw-r--r--. 1 641647 Oct 27 17:32 /path/to/cas/logs/cas.log.2016-10-27

If I don't touch things, it seems to mostly roll the logs daily, but if
I stop and restart the Tomcat container for the app, it appears to roll
the logfile on restart, and discard or overwrite any previous log that
may have been rolled the same day.

Any ideas as to what I'm doing wrong or suggestions onhow to fix this
would be appreciated.

Aloha,
-baron
-- 
Baron Fujimoto <baron@hawaii.edu> :: UH Information Technology Services
minutas cantorum, minutas balorum, minutas carboratum desendus pantorum

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message