OpenShift Pyramid logging to file

123 views Asked by At

I'm deploying my Pyramid app to OpenShift. I'm having a hard time with the logging configuration. I must log to a file so I have this:

[loggers]
keys = root, myapp, sqlalchemy

[handlers]
keys = console, filelog

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_myapp]
level = INFO
handlers = filelog
qualname = myapp
propagate = 0

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[handler_filelog]
class = FileHandler
args = ('%(here)s/myapp.log', 'a')
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

The myapp.log file was created, however when I push my changes no logging is found on this file. And, another thing puzzling me, is that my code logs some warnings that are shown in the python.log visible through rhc tail, but my desired file has no content.

Thanks!

1

There are 1 answers

1
engineerC On

You need to add the filelog handler to the root logger.

[logger_root]
level = INFO
handlers = console, filelog