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

Webpack.logger uses wrong logger #1312

Closed
flippakitten opened this issue Mar 2, 2018 · 2 comments
Closed

Webpack.logger uses wrong logger #1312

flippakitten opened this issue Mar 2, 2018 · 2 comments

Comments

@flippakitten
Copy link
Contributor

flippakitten commented Mar 2, 2018

I'm not sure why this was designed like this but when initializing the Webpacker.logger, if Rails logger is using TaggedLogging, it sets Webpacker.logger to use the Rails logger, otherwise it uses Tagged logging.

The issue is if you have a custom formatter, calling ActiveSupport::TaggedLogging.new will set @formatter to use SimpleFormatter

  initializer "webpacker.logger" do
    config.after_initialize do
      if ::Rails.logger.respond_to?(:tagged)
        Webpacker.logger = ::Rails.logger
      else
        Webpacker.logger = ActiveSupport::TaggedLogging.new(::Rails.logger)
      end
    end
  end

I've opened a PR #1311

@kaspth kaspth closed this as completed Mar 2, 2018
@calleo
Copy link

calleo commented May 14, 2019

Ran into this myself. It doesn't play well at all with other logging libraries like ougai since the tagged logger stringifies the message (which is a hash).

@flippakitten
Copy link
Contributor Author

If anyone comes across this I ended up using SemanticLogger.

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