On Fri, Aug 10, 2007 at 09:31:58PM -0700, Mike Orr wrote:
> How do I get the Pylons logging to work in 0.9.6? I tried a few
> variations on "import logging;
> logging.basicConfig(level=logging.DEBUG)" in environment.py and
> middleware.py, but no log output.
Do you like to log from your application? In that case this should work:
import logging
logging.info('This is just an information')
The default development.ini template in 0.9.6rc1 sets the debug level to
INFO which means that only INFO messages or above are logged. Writing
"logging.debug(...)" will not do anything.
I have even added a custom logger for my application. My logging section
in the Additions to the development.ini:
# Logging Setup
[loggers]
keys = root,myapplication
[logger_myapplication]
level = DEBUG
handlers = myapplication
qualname = myapplication
propagate = 0
[handlers]
keys = console,myapplication
[formatters]
keys = generic,myapplication
[logger_root]
level = INFO
handlers = console
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[handler_myapplication]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
------------
Then in my application I use:
import logging
log = logging.getLogger('myapplication')
log.info('Application is doing something')
> "paster serve --log-file=/tmp/log development.ini" redirects the
> output but doesn't add any more logging. '--verbose' doesn't help
> either.
Try setting "level=DEBUG" for the "logger_root". That will log a lot
more.
Cheers
Christoph
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---