Velocity Reviews

Velocity Reviews (
-   Python (
-   -   How to export a logging level? (

Vincent Vande Vyvre 09-25-2012 04:15 PM

How to export a logging level?
In my application I import a module and I want to set the same logging
as the main app to this module.

I've tried this code

import logging
logger = logging.getLogger(__name__)
lvl = logging.DEBUG
LOG_FORMAT = "%(asctime)-6s %(levelname)s: %(name)s - %(message)s"
logging.basicConfig(format=LOG_FORMAT, datefmt='%H:%M:%S', level=lvl)

from mymodule.myfile import MyClass

def load_myclass(self):
lvl = logger.getEffectiveLevel()
mc = MyClass(self, lvl)

import logging
logger = logging.getLogger(__name__)

class MyClass(object):
def __init__(self, main, lvl):

If I set the level to logging.DEBUG I can see all infos from the main
but anything
from my module.

Thanks for your advice.
Vincent V.V.
Oqapy <> . Qarte
<> . PaQager <>

All times are GMT. The time now is 06:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.