Code Monkey home page Code Monkey logo

Comments (19)

coderberry avatar coderberry commented on July 30, 2024 2

It appears I was doing it wrong. When I correct the code to the following it works:

require 'syslogger'
config.logger = ActiveSupport::TaggedLogging.new(Syslogger.new("fortress-stats", Syslog::LOG_PID, Syslog::LOG_LOCAL7))

from syslogger.

johnnncodes avatar johnnncodes commented on July 30, 2024

@cavneb What version of syslogger did you used? The solution you posted doesn't work on Rails 4.2.6. Syslogger version 1.6.4

from syslogger.

carsonreinke avatar carsonreinke commented on July 30, 2024

@basco-johnkevin are you seeing a specific error or just not seeing entries in the syslog?

from syslogger.

johnnncodes avatar johnnncodes commented on July 30, 2024

@carsonreinke It is throwing this error:

NoMethodError: undefined method `current_tags' for #<Proc:0x007f3a2a515548>

ruby 2.2.5p319
Rails 4.2.6
Syslogger version 1.6.4

from syslogger.

carsonreinke avatar carsonreinke commented on July 30, 2024

@basco-johnkevin can you send over how you are configuring the logger for Rails?

from syslogger.

jnormore avatar jnormore commented on July 30, 2024

I just came across this issue too. It looks to be an issue in anything above rails 4.2.0.

The issue is with https://github.com/rails/rails/blob/v4.2.9/activejob/lib/active_job/logging.rb#L50 reaching into logger.formatter for current_tags but syslogger has this defined as a proc, https://github.com/crohr/syslogger/blob/1.6.4/lib/syslogger.rb#L52

@formatter = proc do |severity, datetime, progname, msg|
      msg
end

This feels more like rails mis-behaving, but still curious if syslogger maintainers have any ideas for fixing here first?

@rafaelfranca thoughts from rails-land? Is it expected that all loggers (and their formatters) conform to tagging stuffs? Also, formatter being a proc?

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

@jnormore : hello! I think it's fixed on the master branch. can you try with it please?

let me know if it's working. if not I'll reopen the issue.

from syslogger.

rafaelfranca avatar rafaelfranca commented on July 30, 2024

If the logger is a tagged logger it is expected their formatters conform with tagging stuff and that is what Rails is expecting since it only try to access current_tags on the formatter when the logger responds to tagged https://github.com/rails/rails/blob/v4.2.9/activejob/lib/active_job/logging.rb#L41

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

@rafaelfranca thanks for the precisions. From what I see it should be working with the master branch : https://github.com/crohr/syslogger/blob/master/lib/syslogger.rb#L120

from syslogger.

rafaelfranca avatar rafaelfranca commented on July 30, 2024

Maybe not? Because Rails will try to access current_tags in the formatter and the formatter is just a proc in the Syslogger case https://github.com/crohr/syslogger/blob/master/lib/syslogger.rb#L50.

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

@rafaelfranca : ok, so I assume this current_tags method is useless (https://github.com/crohr/syslogger/blob/master/lib/syslogger.rb#L142)? And the formatter should be a class and not a proc?

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

But this is weird because on Rails master branch the Formatter doesn't have current_tags : https://github.com/rails/rails/blob/master/activesupport/lib/active_support/logger.rb#L101

It inherits from https://ruby-doc.org/stdlib-2.3.3/libdoc/logger/rdoc/Logger/Formatter.html which don't have the current_tags method too.

I may be wrong, but maybe the bug is to call the current_tags method on the formatter and not on the logger class : https://github.com/rails/rails/blob/v4.2.9/activejob/lib/active_job/logging.rb#L50

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

Ok, got it : https://github.com/rails/rails/blob/master/activesupport/lib/active_support/tagged_logging.rb

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

@jnormore can you please try with the fix_formatter branch?

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

@jnormore hi there! any news?

from syslogger.

jnormore avatar jnormore commented on July 30, 2024

Sorry @n-rodriguez probably not going to get a chance to look into this for another few weeks at least.

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

Hi there! Any news?

from syslogger.

augustosamame avatar augustosamame commented on July 30, 2024

Also got bit by this when trying to install Loggly which uses this gem. Any news if this has been patched in master?

Update: just tried with master branch and I still get the following error:

undefined method `current_tags' for #Proc:0x007fddfc815f60

from syslogger.

n-rodriguez avatar n-rodriguez commented on July 30, 2024

To have the patch you must use the fix_formatter branch.

from syslogger.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.