I wrote a Dancer app, with the log config:
logger: file
logger_format: <%T> %m
log_path: '/usr/local/myapp/log'
log_file: 'myapp.log'
log: debug
and start it with:
plackup -E deployment -D -s Starman --workers=10 --port 8080 -a bin/app.pl
rotate the log file with logrotate
/usr/local/myapp/log/myapp.log {
daily
rotate 10
create 0660 root root
compress
missingok
dateext
}
but the new logfile is zero.
I tried to add postrotate in logrotate conf to send HUP and process HUP sinal in bin/app.pl
with
Dancer::Logger::File::init;
but nothing help.
Can anyone tell me how to rotate the dancer's logfile?
One solution to let this happen is that
plackup
supports the-R
switch to watch a folder, so you could add-R <appdir>/run
and then change logrotate to:As far as I can tell though what you want can't be done in this configuration. Starman explicitly handles sighup to restart the child processes. From Starman/Server.pm:
Perhaps you need an alternative logging solution such as using
Dancer::Logger::Syslog
Or, if you must write to a file, maybe check for changes with
Linux::Inotify2