radiocosmology / alpenhorn

Alpenhorn is a service for managing an archive of scientific data.
MIT License
2 stars 1 forks source link

feat(logger): configure syslog and file logging #162

Closed ketiltrout closed 1 year ago

ketiltrout commented 1 year ago

Allows optional configuration to start up file or syslog logging. File logging may include file rotation and/or watching.

Rotating file logging is necessary for running on cedar. Log messages emitted before enabling the log file are buffered and flushed to the log file once it is opened, meaning the config-loading code can still use the log even before a log-file is opened.

Moves the initial logging setup from import time to an explicit call to init_logging.

Closes #161

ketiltrout commented 1 year ago

This PR introduces a dependency on concurrent-log-handler, which provides a version of the standard RotatingFileHanlder which allows multiple processes to write to the same log file. This is done via a lock file.

This dependency was in alpenhorn1, which is why I've added it here, but I don't think it's necessary. It's not clear to me why we would have multiple things writing to alpenhorn's log file at the same time.

Should I remove it?

The only thing I can think is that maybe we had it in alpenhorn1 due to the old HPSS callback script which used to be executed on another machine on scinet? Even that is no longer done: the main alpenhorn process takes care of everything now for HPSS.