A little warning about the email handler. Remember that SMTPHandler is
a single threaded, blocking, logger. If your logging triggers a email
then all other logging waits until the email is sent. This can quickly
block your entire web app.

We ran into that a couple of days ago. Something caused a logger to
log a critical message which the SMTPHandler picked up and mailed to
us. When that happened the normal info logging was blocked and some of
our timecritical threads started to timeout which in turn triggered
other critical logs. :P

On Jan 9, 4:48 pm, Jason <[email protected]> wrote:
> Can someone help me with my logging configuration? I have read the logging
> and pyramid_exclog documentation and come up with a configuration that I
> think should send errors to both a file handler and an SMTP handler, but
> when an error occurs it is not in the file or emailed -- the error does
> show up in the stdout (or stderr, they redirect to the same file) though. I
> am using Paste server (not in daemon mode) with supervisord and Pyramid
> 1.2. I have absolutely no idea what I have done wrong in this configuration:
>
> [loggers]
> keys = root, buildings, sqlalchemy, access_log, exc_logger
>
> [handlers]
> keys = console, file, exc_handler
>
> [formatters]
> keys = generic
>
> [logger_root]
> level = INFO
> handlers = file
>
> [logger_buildings]
> level = INFO
> handlers =
> qualname = myapp.buildings
>
> [logger_sqlalchemy]
> level = WARN
> handlers =
> qualname = sqlalchemy.engine
> # "level = INFO" logs SQL queries.
> # "level = DEBUG" logs SQL queries and results.
> # "level = WARN" logs neither.  (Recommended for production systems.)
>
> [logger_access_log]
> level = INFO
> handlers =
> qualname = access_log
>
> [logger_exc_logger]
> level = ERROR
> handlers = exc_handler
> qualname = exc_logger
>
> [handler_console]
> class = StreamHandler
> args = (sys.stderr,)
> level = NOTSET
> formatter = generic
>
> [handler_file]
> class = logging.handlers.RotatingFileHandler
> args = ('/var/log/production.log', 'a', 1048576, 25)
> level = INFO
> formatter = generic
>
> [handler_exc_handler]
> class = handlers.SMTPHandler
> args = (('smtp.example.com', 25), '[email protected]',
> ['[email protected]'], '[Error]')
> level = ERROR
> formatter = generic
>
> [formatter_generic]
> format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s]
> %(message)s
> datefmt = %Y-%m-%d %H:%M:%S
>
> I have also tried setting handlers under logger_exc_logger to "exc_handler,
> file" in case it wasn't propagating by default, but that did not change
> anything.
>
> Thanks for the help,
>
> Jason

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to