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

JSON output prepended with non-JSON data #309

Closed
tsvallender opened this issue Jan 27, 2025 · 2 comments
Closed

JSON output prepended with non-JSON data #309

tsvallender opened this issue Jan 27, 2025 · 2 comments

Comments

@tsvallender
Copy link

In my application.rb I have:

    config.semantic_logger.add_appender(io: $stdout, formatter: :json)
    config.log_level = :info
    SemanticLogger.add_appender(appender: :new_relic)

And an example line from my logs is now:

2025-01-27 20:16:35.037614 I [1:puma srv tp 001] (12.2ms) CspReportsController -- Completed #create -- { :controller => "CspReportsController", :action => "create", :format => "*/*", :method => "POST", :path => "/csp-reports", :status => 200, :view_runtime => 0.0, :db_runtime => 17.08, :queries_count => 1, :cached_queries_count => 0, :allocations => 2198, :status_message => "OK" }

I wasn’t expecting the initial 2025-01-27 20:16:35.037614 I [1:puma srv tp 001] (12.2ms) CspReportsController -- Completed #create -- — I thought this data should be converted to JSON. Is this the intended behaviour? Is there a way I can get “pure” JSON output?

@luis30n
Copy link

luis30n commented Jan 28, 2025

Hi mate!
I believe you need something like this:

Image

@tsvallender
Copy link
Author

That’s done it, thank you 🙏

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

2 participants