Log messages are logged twice on the console.

140 views
Skip to first unread message

Srikanth Bemineni

unread,
Jul 23, 2017, 2:54:58 PM7/23/17
to pylons-discuss
Hi,

Every message that I log for debugging purpose are logged twice on the console. I am using the pyramid 1.8.3 with uwsgi running 4 instances during development. All sqlalchemy messages are logged only once

2017-07-23 13:38:28,090 INFO  [project_name:69][b'uWSGIWorker1Core0'] Starting wsgi server
2017-07-23 13:38:28,090 INFO  [project_name:69][b'uWSGIWorker1Core0'] Starting wsgi server
2017-07-23 13:38:26,997 INFO  [project_name.views.session:62][b'uWSGIWorker1Core0'] b'$2b$12$k27v8mo../Re09lTmQ34WO'
2017-07-23 13:38:26,997 INFO  [project_name.views.session:62][b'uWSGIWorker1Core0'] b'$2b$12$k27v8mo../Re09lTmQ34WO'

In development.ini

[loggers]
keys = root, project_name, sqlalchemy 

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_project_name]
level = DEBUG
handlers = console
qualname = project_name

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither.  (Recommended for production systems.)

In main project __init__.py

logging.config.fileConfig(settings["logging.config"],disable_existing_loggers=False) 
log = logging.getLogger(__name__)

Does getLogger create another logger ??

Michael Merickel

unread,
Jul 23, 2017, 10:07:39 PM7/23/17
to Pylons
Remove the console from handlers on logger_project_name as that logger is configured to propagate logs up the tree, meaning the root is logging it as well.

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/e72dd164-a66f-4747-8dc2-15d93b0526f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages