logging setup

15 views
Skip to first unread message

Shannon -jj Behrens

unread,
Feb 24, 2009, 6:49:30 PM2/24/09
to pylons-...@googlegroups.com
It's weird that the default setup in development.ini is:

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

I used log.warn in my controller and it didn't go to stderr.  I changed level to INFO so I can see the logging message.

Best Regards,
-jj

--
In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa
http://jjinux.blogspot.com/

Philip Jenvey

unread,
Feb 24, 2009, 7:10:06 PM2/24/09
to pylons-...@googlegroups.com

On Feb 24, 2009, at 3:49 PM, Shannon -jj Behrens wrote:

> It's weird that the default setup in development.ini is:
>
> [handler_console]
> class = StreamHandler
> args = (sys.stderr,)
> level = NOTSET
> formatter = generic
>
> I used log.warn in my controller and it didn't go to stderr. I
> changed level to INFO so I can see the logging message.


Works for me. The console handler isn't filtering anything, its level
is NOTSET so it should be logging everything that goes through it.

The Pylons project's top level package should have its own logger set
to DEBUG by default, which means any logger under it, like
myapp.controllers.mycontroller, should be sending WARN to the console
handler.

--
Philip Jenvey

Mike Orr

unread,
Feb 24, 2009, 7:52:33 PM2/24/09
to pylons-...@googlegroups.com

The default level is set to INFO, while the application level is DEBUG
(for all modules in the application package). This can lead to debug
messages from other modules not showing up. When I'm doing ad-hoc
debugging, sometimes I log messages as warn or error to avoid having
to change the configuration.

I think there might have been a few times I couldn't get WARN messages
through but I don't remember the circumstances.

If you make a new config file via paster, its default level is INFO
throughout. I change that to WARN for production.ini.

--
Mike Orr <slugg...@gmail.com>

Philip Jenvey

unread,
Feb 24, 2009, 8:13:06 PM2/24/09
to pylons-...@googlegroups.com

On Feb 24, 2009, at 4:52 PM, Mike Orr wrote:

>
> The default level is set to INFO, while the application level is DEBUG
> (for all modules in the application package). This can lead to debug
> messages from other modules not showing up. When I'm doing ad-hoc
> debugging, sometimes I log messages as warn or error to avoid having
> to change the configuration.
>

That's the intention, I think root at DEBUG by default is too chatty
for most people. Most probably don't care to see all of the Pylons'
internal debug logging by default, for example. SQLAlchemy is super
chatty on DEBUG too.

It's super easy to switch during development though, --reload also
monitors development.ini for changes.

> If you make a new config file via paster, its default level is INFO
> throughout. I change that to WARN for production.ini.


Yea, WARN would be more appropriate for prod. Let's change it

--
Philip Jenvey

Reply all
Reply to author
Forward
0 new messages