zormandi / logcraft

A zero-configuration structured logging solution for pure Ruby or Ruby on Rails projects.
MIT License
38 stars 2 forks source link

Logcraft causing errors in ActiveSupport's TaggedLogging #9

Open kavinphan opened 3 weeks ago

kavinphan commented 3 weeks ago

I'm trying to to integrate logcraft in a Rails 6.1 project, but I am receiving errors from different parts of the application that interact with ActiveSupport's TaggedLogging. These errors appear immediately after installing logcraft with no configuration.

When starting the web server (Puma)

/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.8/lib/active_support/tagged_logging.rb:31:in `call': wrong number of arguments (given 0, expected 4) (ArgumentError)
        from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.4.2/lib/puma/configuration.rb:82:in `block in finalize_values'
        from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.4.2/lib/puma/configuration.rb:80:in `each'
        from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.4.2/lib/puma/configuration.rb:80:in `finalize_values'
        from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.4.2/lib/puma/configuration.rb:260:in `clamp'
        from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.4.2/lib/puma/launcher.rb:77:in `initialize'
        from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.4.2/lib/rack/handler/puma.rb:72:in `new'
        from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.4.2/lib/rack/handler/puma.rb:72:in `run'
        from /app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.9/lib/rack/server.rb:327:in `start'
        from /app/vendor/bundle/ruby/3.2.0/gems/railties-6.1.7.8/lib/rails/commands/server/server_command.rb:39:in `start'
        from /app/vendor/bundle/ruby/3.2.0/gems/railties-6.1.7.8/lib/rails/commands/server/server_command.rb:144:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /app/vendor/bundle/ruby/3.2.0/gems/railties-6.1.7.8/lib/rails/commands/server/server_command.rb:135:in `perform'
        from /app/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
        from /app/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /app/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
        from /app/vendor/bundle/ruby/3.2.0/gems/railties-6.1.7.8/lib/rails/command/base.rb:69:in `perform'
        from /app/vendor/bundle/ruby/3.2.0/gems/railties-6.1.7.8/lib/rails/command.rb:48:in `invoke'
        from /app/vendor/bundle/ruby/3.2.0/gems/railties-6.1.7.8/lib/rails/commands.rb:18:in `<main>'
        from <internal:/root/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/root/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /app/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from bin/rails:4:in `<main>'

This error also seems to happen when initializing Redis.

zormandi commented 1 week ago

Unfortunately, Logcraft can't work properly with absolutely zero configuration. It doesn't need much tinkering but it does need a tiny bit. As mentioned in the README:

For Logcraft to work properly, you need to delete or comment out the logging configuration options in the generated config/environments/production.rb file.

If that doesn't work, are you by any chance configuring Puma's logger manually?