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
Just want to begin by saying I'm eternally grateful for the release of this module as a standalone package. This is a super clean general purpose implementation of JAB.
That being said, I'd really appreciate it if the calls to the root logger could be removed in a future release. At the moment I have to do something pretty hacky to stop the JABWrapper module from adding unwanted handlers and formatters to the root logger.
defmonkey_patch_logging():
"""Initial Load of JABWrapper here to prevent it from using the root logger"""classMetaReturnsCLS(type):
def__getattr__(cls, name):
returnlambda*args, **kwargs: clsclassLoggingFacade(metaclass=MetaReturnsCLS):
jab_logger=logging.getLogger("JABWrapper")
debug=jab_logger.debuginfo=jab_logger.infoDEBUG=logging.DEBUGINFO=logging.INFOsys.modules[logging.__name__] =LoggingFacadeimportJABWrapperfromJABWrapper.jab_wrapperimportJavaAccessBridgeWrapperfromJABWrapper.jab_typesimportJavaObjectsys.modules[logging.__name__] =logging
This is the only way I was able to both keep my logger hierarchy clean and prevent jab_wrapper.log files showing up in my project directory.
It'd be really simple to fix this issue, it'd only require that the method calls to the logging module itself be substituted with calls to a package local logger. Then, an importing user like myself could chose to enable/disable the logging therein.
importlogging# not thislogging.basicConfig(level=logging.DEBUG, handlers=[logging_file_handler, logging_stream_handler])
logging.debug("my debug message")
# do thislogger=logging.getLogger("JABWrapper")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging_file_handler)
logger.addHandler(logging_stream_handler)
logger.debug("my debug message")
Is this something you'd be willing accept pull requests on?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi there,
Just want to begin by saying I'm eternally grateful for the release of this module as a standalone package. This is a super clean general purpose implementation of JAB.
That being said, I'd really appreciate it if the calls to the root logger could be removed in a future release. At the moment I have to do something pretty hacky to stop the JABWrapper module from adding unwanted handlers and formatters to the root logger.
This is the only way I was able to both keep my logger hierarchy clean and prevent
jab_wrapper.log
files showing up in my project directory.It'd be really simple to fix this issue, it'd only require that the method calls to the logging module itself be substituted with calls to a package local logger. Then, an importing user like myself could chose to enable/disable the logging therein.
Is this something you'd be willing accept pull requests on?
Thanks!
The text was updated successfully, but these errors were encountered: