conman icon indicating copy to clipboard operation
conman copied to clipboard

Logging directive doesn't get expanded after initial start

Open GoogleCodeExporter opened this issue 10 years ago • 4 comments

For a log directive like:

global log="%N/%Y-%m-%d.log"

the variables will be expanded when conman starts, and you'll get logs like:

server1/2012-03-15.log

However, all log entries will be written to this file until the process is restarted. It would be nice if these variables could be expanded when log lines need to be written (or at least periodically) in order to permit automatic log file changes (e.g. to server1/2012-03-16.log the next day).

Original issue reported on code.google.com by [email protected] on 21 Mar 2012 at 10:39

GoogleCodeExporter avatar Mar 17 '15 18:03 GoogleCodeExporter

conmand will re-evaluate conversion specifiers within filenames and re-open log files if it receives a SIGHUP.

Original comment by chris.m.dunlap on 21 Mar 2012 at 10:47

GoogleCodeExporter avatar Mar 17 '15 18:03 GoogleCodeExporter

BTW, this has been the behavior since 0.1.8.5.

Did you have something else in mind?

Original comment by chris.m.dunlap on 21 Mar 2012 at 11:05

GoogleCodeExporter avatar Mar 17 '15 18:03 GoogleCodeExporter

Yeah, I was hoping it would function more like automatically rolling the logs as the time changed, sort of how cronolog works for Apache.

I can achieve my desired behavior by HUPing conmand at midnight, which is fine. So maybe all that's needed is a note in the docs that the variables are only expanded at start and when the config is reloaded in order to manage user expectations?

Original comment by [email protected] on 21 Mar 2012 at 11:26

GoogleCodeExporter avatar Mar 17 '15 18:03 GoogleCodeExporter

This issue was updated by svn:r1077 / 92d014a55d9a6d4a40cfe975279f95f18ab7a800.

Conversion specifiers within console log filenames are evaluated
when the file is opened; this occurs when conmand first starts and
whenever it receives a SIGHUP.

Original comment by chris.m.dunlap on 27 Mar 2012 at 9:51

GoogleCodeExporter avatar Mar 17 '15 18:03 GoogleCodeExporter