You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current logging configuration in logging_config.py hardcodes some logging configuration, which causes difficult errors in some deployment scenarios. For example, because a logging FileHandler is hardcoded to use the file /tmp/log.log, if multiple users try to use the library on the same machine, they get permissions errors because they can't create the needed logging file on import.
In general, packages and library modules should not configure logging, rather deferring to the main module to configure logging in a way that works for its deployment scenario. This is described in the logging tutorial here: https://docs.python.org/2/howto/logging.html#logging-from-multiple-modules
The only thing that a typical package or module should configure for logging is to set a name for its logger, which by convention is set to the package or module __name__, which allows the logs from each module to be distinguished and controlled independently. This is typically done for the package in the __init__.py file with a statement like:
The current logging configuration in
logging_config.py
hardcodes some logging configuration, which causes difficult errors in some deployment scenarios. For example, because a logging FileHandler is hardcoded to use the file/tmp/log.log
, if multiple users try to use the library on the same machine, they get permissions errors because they can't create the needed logging file on import.In general, packages and library modules should not configure logging, rather deferring to the main module to configure logging in a way that works for its deployment scenario. This is described in the logging tutorial here: https://docs.python.org/2/howto/logging.html#logging-from-multiple-modules
The only thing that a typical package or module should configure for logging is to set a name for its logger, which by convention is set to the package or module
__name__
, which allows the logs from each module to be distinguished and controlled independently. This is typically done for the package in the__init__.py
file with a statement like:Module level loggers should use the same code, but are typicially initialized at the top of the module. See the tutorial for details: https://docs.python.org/2/howto/logging.html#advanced-logging-tutorial
In our case, I think a simple logging scenario would be to:
logger = logging.getLogger(__name__)
to the package__init__.py
I will file an identical issue for the viz-staging package, which has the same issues.
For an overview of one approach, see for example: https://stackoverflow.com/a/50751987
The text was updated successfully, but these errors were encountered: