Hello Lars,

Did you read that :
https://github.com/web2py/web2py/blob/0d646fa5e7c731cb5c392adf6a885351e77e4903/examples/logging.example.conf

I am looking at logging rigth now a new module and I do my research...

Setting global logger might be one of the main reason of your issue as I
guess you are shadowing web2py internal loggin activity???

Richard

On Thu, Aug 31, 2017 at 7:47 AM, Lars <laerc...@gmx.fr> wrote:

> The code needs to be in model not in modules.
>
> Could anyone explain why ?
>
>
>
> On Thursday, August 31, 2017 at 12:38:32 PM UTC+2, Lars wrote:
>>
>> Hi,
>>
>> I have this code in dlogging.py in the modules folder of my app :
>>
>> import logging
>> import logging.handlers
>>
>>
>> def get_configured_logger(name):
>>     global logger
>>     logger = logging.getLogger(name)
>>     if len(logger.handlers) == 0:
>>         fh = logging.FileHandler(os.path.join('/'.join(os.path.realpath(_
>> _file__).split('/')[:-3]),
>>                                  'logs/system.log'))
>>         formatter = logging.Formatter('%(asctime)s - %(levelname)s
>> %(message)s')
>>         fh.setFormatter(formatter)
>>         logger.addHandler(fh)
>>         logger.setLevel(logging.DEBUG)
>>     return logger
>>
>> logger = get_configured_logger('web2py.app.system')
>>
>> I don't understand why it works in the shell but not from web2py from
>> inside a module class (with from dloggig import logger). Could anybody
>> figure why ?
>>
>> Thanks
>>
>> w2p : 2.15.3 py : 3.5.3
>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to