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

Suggested configurations leads to exceptions for third party libs. #116

Closed
hyksos opened this issue May 12, 2017 · 1 comment
Closed

Suggested configurations leads to exceptions for third party libs. #116

hyksos opened this issue May 12, 2017 · 1 comment

Comments

@hyksos
Copy link

@hyksos hyksos commented May 12, 2017

Hi,

Python 2.7.5
CentOS Linux release 7.2.1511 (Core)

I tried the suggestion named:

Rendering Using structlog-based Formatters Within logging

From:
http://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging

The only thing I added was:

import boto3  
ec2 = boto3.client('ec2')
response = ec2.describe_regions()
print('Regions:', response['Regions'])
response = ec2.describe_availability_zones()
print('Availability Zones:', response['AvailabilityZones'])

(This issue is not related to the third party lib used, I got the same thing with other third party libs, just needed one as a minimal repro case.)

This leads to a ton of exception that ends with:

File "/usr/lib64/python2.7/logging/init.py", line 328, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting

My goal is to use structlog to get all my logs and those from imported third party libs to be formatted in JSON with a basic set of common keys. But I started with using the documentation as is first to understand how it works.

I was expecting boto3 logs to be formatted and it worked, somewhere in the console output (and the log file) there is:

2017-05-12 19:57:08 [info ] Starting new HTTP connection (1): 169.254.169.254

What I don't understand are all the Exception thrown from inside the logging library that are in visible in the std err output. Should the suggested config work in this scenario?

Attached are the source code file used, the log file from the WatchedFileHandler and console output file where the exceptions are visible. It was generated with:
python issue.py &> console_output.txt

console_output.txt
filehandler_output.txt
source_code.txt

Martin

@hynek
Copy link
Owner

@hynek hynek commented May 13, 2017

Hi Martin, thank you very much for that detailed bug report! I think I’ve identified the reason for the breakage and will try to get a fix out ASAP.

@hynek hynek closed this in #117 May 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.