On Aug 16, 2010, at 5:25 PM, Yarin wrote:

> @Jonathan- I'd like to see what you've got- keep me updated

The patch is here, if anyone would like to review it.

http://web.me.com/jlundell/filechute/logging.zip

Most of the changes are to use a specific logger instead of making a generic 
logging call. The only interesting code is in main.py, along with 
logging.example.conf.

Nothing much to it: just loading a configuration file, and using specific 
loggers.

> 
> On Aug 16, 5:03 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>> On Aug 16, 2010, at 1:31 PM, Yarin wrote:
>> 
>> 
>> 
>>> I've posted an updated slice with an in-depth treatment of logging in
>>> web2py.
>>> http://web2pyslices.com/main/slices/take_slice/91
>> 
>> I've got a patch pending that adds a (standard format) logging configuration 
>> file, and converts all of web2py's logging calls to use it.
>> 
>> It has a logger named "web2py.app", so you can getLogger("web2py.app.myapp") 
>> and log calls will propagate to that logger (or you can create a new 
>> "web2py.app.myapp" logger definition in the config file).
>> 
>> Initialization happens when web2py loads, so you don't have to test for 
>> configuration.
>> 
>> 
>> 
>> 
>> 
>>> Based on our earlier discussion
>>> http://groups.google.com/group/web2py/browse_thread/thread/d3b534113a...
>> 
>>> The slice addresses the issues of application-level logging, once-only
>>> configuration, and simpler syntax. It offers an approach that fully
>>> leverages Python's native logging capabilities, allows for full
>>> flexibility in configuration, and doesn't interfere with existing
>>> logging implementations.
>> 
>>> Some notes:
>>> -I decided against creating a separate contrib module for the code as
>>> it would impede flexibility and obscure the simplicity of solution.
>>> If included in the framework, I think it should be as model code.
>>> -I abandoned the cache approach to creating singleton loggers, and
>>> just inspect handlers instead.  (Logger caching was causing problems
>>> on GAE)
>> 
>>> Let me know what you think.  Thanks Massimo, Iceberg...


Reply via email to