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

Logger defaults to Rails.logger if run in Rails environment -- can't turn off API response payloads #389

Closed
daveespo opened this issue Mar 31, 2016 · 3 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@daveespo
Copy link

My Rails log file is overflowing with the payload of every API response from the GMail v1 API

The docs here suggest setting your level to INFO to silence the output:

https://developers.google.com/api-client-library/ruby/guide/logging

But when you do that, all of your Rails standard debug logging goes away. Digging in, I see that Google::Apis assigns its logger to the Rails.logger if it's defined.

This seems like a strange choice and almost never the right answer.

I realize that the workaround is to construct a new Logger and assign it to Google::Apis.logger -- but that should be documented as the proper way to adjust logging

Or perhaps the default should be to use the $stdout logger and Rails users can choose to pollute their Rails log file by reassigning the logger accordingly

Oh, how I miss Log4j :-)

@sqrrrl
Copy link
Contributor

sqrrrl commented Apr 11, 2016

Unfortunately I don't think I can change this behavior until the next major bump since there could be people expecting/relying on the current behavior. That said, I'll update the docs to make this clearer.

If it helps, I'd be willing to add a simpler mechanism to turn this on/off (albeit default to on) like an environment variable or something along those lines.

@daveespo
Copy link
Author

I think an option (supporting both ENV or explicit Google::Apis method) for specifying what level to dump payloads would be best .. and yeah, it could default to DEBUG but you could specify NONE if you want to shut it off (not my preference since most client libraries don't enable this level of tracing by default .. but if it's really necessary for backwards compat, I understand)

@sqrrrl
Copy link
Contributor

sqrrrl commented Apr 14, 2016

Added a bypass mechanism + updated the readme with more details on how to configure logging.

@sqrrrl sqrrrl closed this as completed Apr 14, 2016
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants