Skip to content
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

LoggingInstrumentation: Set Handler Format Explictly If basicConfig Has Already Been Called #1939

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ def record_factory(*args, **kwargs):
)
log_level = log_level or logging.INFO

logging.basicConfig(format=log_format, level=log_level)
root_logger = logging.getLogger()
if root_logger.hasHandlers():
for handler in root_logger.handlers:
handler.setFormatter(logging.Formatter(log_format))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about log_level?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocelotl Is there a reason to review this pr and not the more recent one here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocelotl, as @dhofstetter, said lets go with their newer and more complete pr. i meant this as more a discussion starter.

thanks for the review though.

also ill close this pr so its not confusing anymore

else:
logging.basicConfig(format=log_format, level=log_level)

def _uninstrument(self, **kwargs):
if LoggingInstrumentor._old_factory:
Expand Down
Loading