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

JSON logging #1152

anton-johansson opened this Issue Jan 10, 2019 · 2 comments


None yet
3 participants
Copy link

anton-johansson commented Jan 10, 2019

Is it possible to get JSON output in the logs? For example, the following log line:

2019-01-10 12:15:07 root:DEBUG thumbor running at

... would be awesome to be able to have as:

  "timestamp": "2019-01-10 12:15:07",
  "name": "root",
  "level": "DEBUG",
  "message": "thumbor running at"

I guess I could just tweak the format, but I'd need to escape the message, in case the message would have qoutes in it. Ideas?


This comment has been minimized.

Copy link

heynemann commented Jan 10, 2019

Would be good to have structured logging in thumbor, but I think the best way to go about this is to use thumbor's own mechanisms for extensibility and allow people to implement their own loggers.

What do I mean by that?

We could change all logging in thumbor to be something like:

logger.debug('Something happened.', image_url=image_url)

Then we'd implement the StdoutLogger that just prints these as:

2019-01-10 12:15:07 Something happened (image_url='/something.jpg')

As well as the JSONLogger, that prints:

  "timestamp": "2019-01-10 12:15:07",
  "level": "DEBUG",
  "message": "Something happened",
  "image_url": "/something.jpg"

What do you guys think?


This comment has been minimized.

Copy link

dhardy92 commented Jan 10, 2019

You need just a Formatter for that.
There are plenty of them out there but this is a nice documentation :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment