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

Logstasher is not Logging Errors #79

Closed
msdundar opened this issue Jun 9, 2015 · 5 comments · May be fixed by #108
Closed

Logstasher is not Logging Errors #79

msdundar opened this issue Jun 9, 2015 · 5 comments · May be fixed by #108
Assignees

Comments

@msdundar
Copy link

msdundar commented Jun 9, 2015

Hi,

I'm running a rails 4 application in development mode.

Here is my config/environments/development.rb =>

  # Logstasher Config
  # Enable the logstasher logs for the current environment
  config.logstasher.enabled = true

  # This line is optional if you do not want to suppress app logs in your <environment>.log
  config.logstasher.suppress_app_log = false

  # This line is optional, it allows you to set a custom value for the @source field of the log event
  config.logstasher.source = 'foobar'

  # This line is optional if you do not want to log the backtrace of exceptions
  config.logstasher.backtrace = false

  # This line is optional, defaults to log/logstasher_<environment>.log
  config.logstasher.logger_path = 'log/logstasher.log'

The problem is, when an application error occurs (like 404 not found) I can see the error in log/development.log but not in log/logstasher.log

How can I solve this issue?

@sfate
Copy link

sfate commented Jun 22, 2015

Seems problem occurs for any log_level..
As you can see here: https://github.com/shadabahmed/logstasher/blob/master/lib/logstasher/railtie.rb#L7
Logstasher initialized as instance of ActiveSupport::OrderedOptions:

config.logstasher = ActiveSupport::OrderedOptions.new

But in new rails it also inherit an ActiveSupport default logger, which sending output to stdout.

And after that.. we moving to setup method.. where we have already defined logger:

self.logger = app.config.logstasher.logger || new_logger(self.logger_path)

And now at any call of logger output sends to default ActiveSupport::OrderedOptions logger..

This can be monkeypatched as follow:

# add this info your development.rb or other environment file
config.to_prepare do
  LogStasher.logger = Logger.new("#{Rails.root}/log/logstash_#{Rails.env}.log")
end

@hut8
Copy link

hut8 commented Oct 22, 2015

+1 for this issue -- even with the monkey patch, I can't get my development Rails.logger.info to display anything in the logstash log.

@astutejoe
Copy link

Same here... Even with the ninja Monkey Patch, no logger calls is logged

@MarcGrimme
Copy link
Collaborator

MarcGrimme commented Jun 25, 2016

You might want to check #108 .
There is still one open topic but for me it's minor and should be fixed in another subsequent PR.
Comments welcome.

@MarcGrimme MarcGrimme self-assigned this Jun 25, 2016
MarcGrimme pushed a commit to MarcGrimme/logstasher that referenced this issue Jun 30, 2016
@MarcGrimme
Copy link
Collaborator

Other then this I'd say get it merged soon as this is really a pain.

MarcGrimme pushed a commit to MarcGrimme/logstasher that referenced this issue Jul 6, 2016
MarcGrimme pushed a commit to MarcGrimme/logstasher that referenced this issue Jul 6, 2016
MarcGrimme pushed a commit to MarcGrimme/logstasher that referenced this issue Jul 6, 2016
artemshut pushed a commit to artemshut/logstasher that referenced this issue Jan 27, 2020
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

Successfully merging a pull request may close this issue.

5 participants