Change OmniAuth log format to JSON
What does this MR do?
OmniAuth log to STDOUT: https://github.com/omniauth/omniauth#logging (https://github.com/omniauth/omniauth/blob/ace4ba366aac0ec249ad563534ae600ffe93019d/lib/omniauth/strategy.rb#L205, https://github.com/omniauth/omniauth/blob/ace4ba366aac0ec249ad563534ae600ffe93019d/lib/omniauth/strategy.rb#L163)
Puma has overwritten (reopen) STDOUT https://github.com/puma/puma/blob/b41205f5cacbc2ad0060472bdce68ba636f42175/lib/puma/runner.rb#L124
So OmniAuth will log to Puma stdout.
We have changed the Puma log format to JSON. To be consistent, we will use JSON format for OmniAuth log as well.
Search in OmniAuth Gem, there are info
and error
logs. To reduce noise in the production log: we will keep only error
log in production. But we will keep all logs(default logger level is debug
) in development/test.
log :info, 'Rendering form from supplied Rack endpoint.'
log :info, 'Rendering form from underlying application.'
log :info, 'Callback phase initiated.'
log :info, 'Setup endpoint detected, running now.'
log :info, 'Calling through to underlying application for setup.'
log :error, "Authentication failure! #{message_key}: #{exception.class}, #{exception.message}"
log :error, "Authentication failure! #{message_key} encountered."
The new log format example:
{"severity":"INFO","timestamp":"2020-02-24T06:15:16.133Z","pid":66257,"progname":"omniauth","message":"Rendering form from supplied Rack endpoint."}
{"severity":"ERROR","timestamp":"2020-02-24T06:08:30.611Z","pid":66257,"progname":"omniauth","message":"test error message"}
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Closes #205184 (closed)