-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot disable logging #86
Comments
Also wondering about this |
At the very least, is it possible to over-ride the variables from inside constants.py? I'm assuming updating a variable like defaultLoggingLevel to None might disable logging? |
@brianmc Are you the owner of this project at Auth.net? |
Honestly, I do a dirty, filthy monkey patch of the import logging
from authorizenet import apicontractsv1, apicontrollers
log = logging.getLogger('creditcard')
if not settings.AUTHORIZE_NET_LOG:
log.setLevel(logging.CRITICAL)
def _fake_config (*args, **kwargs): # pragma: no cover
pass
log.basicConfig = _fake_config
apicontrollers.logging = log
apicontrollers.apicontrollersbase.logging = log
Side note: by importing |
@rneilson I feel like I need to shower after reading this. But if it works it works. On a serious note, where are the maintainers for this repo? |
@kbuilds I almost went to confession after writing it, and I'm not even Catholic. It mostly works -- there are still some stray error messages from As for maintainers: @Sapbasu15? @sunnyrajrathod? |
@rneilson @kbuilds we are planning to move default logging to stderr stream with critical level (almost similar to no logging), and logging level and destination (file/stream) will be configurable via ini file. Also you'll be able to add handlers to root logger and configure it if required. |
@Sapbasu15 I would actually vastly prefer no logger configuration be done inside the library, just a standard named logger I can configure as I wish, no extra .ini file required. (If you do set any defaults on the logger, please make sure they're done at the module's top level, not when instantiating a controller like it is now.) |
@rneilson we can provide a named logger like 'authorizenet_sdk' and add a null handler to it, assuming a configured handler to be added by developer. Currently its using the root logger only. It seems root logger has to be configured to avoid 'no logger' messages from pyxb. Also we think it'll be good to provide some defaults for ease of use, which can be done at module level rather than base constructor. |
@Sapbasu15 Quite honestly, if the library configures anything on the root logger, that would be just as bad as the current setup, because it's likely to clobber (or, almost as bad, silently change) existing configuration. And I suspect if you set a null handler for the Just don't touch my root logger, y'know? |
Fix for the issues is released in PR #102 and has been released in the latest version. |
Looks like the logging info is writing to a file called
anetsdk.log
by default. I need to disable this log, as all messages are being handled by exceptions, and the log file is causing issues with permissions on every server that my software is being deployed to.Any ideas on how to disable this via configuration?
The text was updated successfully, but these errors were encountered: