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
As a user setting Logging=False as a param on initialization of the JIRA class, I'd like for logging to be turned off entirely, so that I can structure my logs flexibly within my service wrapped around this class. However, I recently noticed (presumably following this change) the following issues that lead to this Logging = False preference not to necessarily be honored as I'd expect it to be.
Areas for Improvement:
Tracebacks being printed due to using logging.exception in _create_oauth_session. This is notably the only place in the file where an exception is logged (here).
Each attempt to try a different signature_method for the creds generates an exception currently, although it's intentional to attempt to iterate through other options until we reach the last fallback option.
The exception log statement mentions "Consider specifying the signature via oauth['signature_method']" even if the signature_method was provided as a param on the initialization. (Actually recognizing whether a signature_method was used before recommending that would be an improvement.)
References:
The logic to acknowledge the Logging param is set here
Rough Suggestions:
method_provided = oauth.get("signature_method")
....
except JIRAError as error:
if not method_provided:
_logging.debug(
f"Failed to create OAuth session with signature_method={sha_type}."
+ "Attempting fallback method(s)."
+ "Consider specifying the signature via oauth['signature_method']."
)
else:
_logging.debug(
f"Failed to create OAuth session with signature_method={sha_type}."
+ "Attempting fallback method(s)."
)
if sha_type is FALLBACK_SHA:
raise error # We have exhausted our options, bubble up exception
Is there an existing issue for this?
I have searched the existing issues
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
9.7.1
jira-python version
3.5.2
Python Interpreter version
3.10
Which operating systems have you used?
Linux
macOS
Windows
Reproduction steps
# 1. Given a Jira client instancejira: JIRA# 2. When I initialize the Jira client instance and my OAuth credentials have expired and call the following function JIRA(options={"server": uri}, oauth=self.oauth, logging=False)
whereself.oauthcontains"signature_method": "RSA-SHA1",
Thanks for the report, if anyone wants to take this on, the fix is to replace the calls to the global logging object _logging with the self.log object, which applies the log level accordingly.
Bug summary
As a user setting Logging=False as a param on initialization of the JIRA class, I'd like for logging to be turned off entirely, so that I can structure my logs flexibly within my service wrapped around this class. However, I recently noticed (presumably following this change) the following issues that lead to this Logging = False preference not to necessarily be honored as I'd expect it to be.
Areas for Improvement:
logging.exception
in_create_oauth_session
. This is notably the only place in the file where an exception is logged (here).signature_method
for the creds generates an exception currently, although it's intentional to attempt to iterate through other options until we reach the last fallback option.signature_method
was provided as a param on the initialization. (Actually recognizing whether a signature_method was used before recommending that would be an improvement.)References:
Rough Suggestions:
Is there an existing issue for this?
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
9.7.1
jira-python version
3.5.2
Python Interpreter version
3.10
Which operating systems have you used?
Reproduction steps
Stack trace
Expected behaviour
no logs or tracebacks
Additional Context
No response
The text was updated successfully, but these errors were encountered: