Accessing a logger across multiple modules in Python logging -


i have little question regarding python logging module.

i have simple logger

logger=basicconfig()

how access same logger using getlogger()?

or getlogger() give me logging object can access?

if how access same logger in program?

apologies if wrong place ask this.

the python logging.getlogger(name) returns same logger object name within process.

the python best practice of using of loggers each python module defines own logger @ beginning of .py file.:

  import logging    logger = logging.getlogger(__name__)    # logger   def foobar():        logger.debug("in foobar") 

this allows later turn on , off , adjust levels of individual loggers using python's logging configuration. generally, not want share logger across modules unless have specific use case.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -