Skip to content

Add support for logging configuration file in segment-gatherer #171

@gerritholl

Description

@gerritholl

Segment gatherer currently has a hardcoded logging configuration, logging everything to stderr or to a file with hardcoded internal log rotation:

def setup_logging(opts, name):
"""Set up logging."""
handlers = []
if opts.log:
handlers.append(logging.handlers.TimedRotatingFileHandler(opts.log,
"midnight",
backupCount=7))
handlers.append(logging.StreamHandler())
if opts.verbose:
loglevel = logging.DEBUG
else:
loglevel = logging.INFO
for handler in handlers:
handler.setFormatter(logging.Formatter("[%(levelname)s: %(asctime)s :"
" %(name)s] %(message)s",
'%Y-%m-%d %H:%M:%S'))
handler.setLevel(loglevel)
logging.getLogger('').setLevel(loglevel)
logging.getLogger('').addHandler(handler)
logging.getLogger("posttroll").setLevel(logging.INFO)
return logging.getLogger(name)

Other pytroll packages, such as pytroll-watcher or trollflow2, can use an external logging configuration file logging.yaml. It would be nice if the segment gatherer could also use logging.yaml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions