Skip to content

launchdarkly logging spams rails console #114

Closed

Description

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

You have to hit enter to skip past it

Activity

  1. eli-darkly commented on Jan 3, 2019

    @eli-darkly
    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.

  2. AndrewRayCode commented on Jan 4, 2019

    @AndrewRayCode
    Author

    hi eli

  3. eli-darkly commented on Jan 4, 2019

    @eli-darkly
    Contributor

    Hey!

  4. eli-darkly commented on Jan 7, 2019

    @eli-darkly
    Contributor

    Was my comment helpful? Should I close the issue?

  5. eli-darkly commented on Jan 29, 2019

    @eli-darkly
    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.

  6. added a commit that references this issue on May 9, 2019
  7. camilohollanda commented on Jun 3, 2024

    @camilohollanda

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions