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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to