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

launchdarkly logging spams rails console #114

Closed
AndrewRayCode opened this issue Jan 3, 2019 · 6 comments
Closed

launchdarkly logging spams rails console #114

AndrewRayCode opened this issue Jan 3, 2019 · 6 comments

Comments

@AndrewRayCode
Copy link

> rails c
[1] pry(main)> [LDClient] sending 2 events: [{"kind":"index","...}]}}}]

You have to hit enter to skip past it

@eli-darkly
Copy link
Contributor

I'm not very familiar with Rails, but it sounds to me like there are two issues here.

  1. You're getting more log output than you want. The SDK uses the standard Rails.logger, and the particular message you copied is logged at debug level. So if you set Rails.logger.level to :info, :warn, or :error, the debug messages won't appear.

  2. Log messages are appearing in the Rails console and this requires you to hit Enter. I don't know why that happens, but again we're using a standard Rails logging mechanism so I wouldn't expect this behavior to be specific to our SDK. You should be able to redirect the logger to a file, if that's what you prefer.

@AndrewRayCode
Copy link
Author

hi eli

@eli-darkly
Copy link
Contributor

Hey!

@eli-darkly
Copy link
Contributor

Was my comment helpful? Should I close the issue?

@eli-darkly
Copy link
Contributor

It's been three weeks with no update, so I'm closing this issue. Please feel free to reopen it if you have more information or questions.

eli-darkly added a commit that referenced this issue May 9, 2019
…n-templates

applying markdown templates and updating repository url references
@prem-prakash
Copy link

prem-prakash commented Jun 3, 2024

It would be nice to be able to choose a logger or at least the log level for the LD logger instance.

I see it is doable through the initializer of the client. Good job! Thanks

 logger = if ENV.fetch('SUPRESS_LAUNCHDARKLY_OUTPUT', false)
    ::Logger.new($stdout, level: ::Logger::ERROR)
  else
    Rails.logger
  end

  launch_darkly_sdk_key = ENV.fetch('LAUNCHDARKLY_SDK_KEY')
  ld_client_config = LaunchDarkly::Config.new(logger: logger, diagnostic_opt_out: true)
  Rails.configuration.launch_darkly_client = LaunchDarkly::LDClient.new(launch_darkly_sdk_key, ld_client_config)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants