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

Fix for incorrectly private method in DecoratingFormatter #2078

Merged
merged 4 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## dev

Version <dev> of the agent adds the ability to filter logs by level, expands instrumentation for Action Cable, and provides a bugfix for Code-Level Metrics.
Version <dev> of the agent adds the ability to filter logs by level, expands instrumentation for Action Cable,provides bugfix for Code-Level Metrics, and a bugfix for `NewRelic::Agent::Logging::DecoratingFormatter#clear_tags!` being incorrectly private.

- **Feature: Filter forwarded logs based on level**

Expand All @@ -24,6 +24,10 @@ Version <dev> of the agent adds the ability to filter logs by level, expands ins

Controllers in Rails automatically render views with names that correspond to valid routes. This means that a controller method may not have a corresponding method in the controller class. Code-Level Metrics now report on these methods and don't log false warnings. Thanks to [@jcrisp](https://github.com/jcrisp) for reporting this issue. [PR#2061](https://github.com/newrelic/newrelic-ruby-agent/pull/2061)

- **Bugfix: Private method `clear_tags!` for NewRelic::Agent::Logging::DecoratingFormatter**
tannalynn marked this conversation as resolved.
Show resolved Hide resolved

As part of a refactor included in a previous release of the agent, the method `NewRelic::Agent::Logging::DecoratingFormatter#clear_tags!` was incorrectly made private. This method is now public again. Thanks to [@dark-panda](https://github.com/dark-panda) for reporting this issue. [PR#](https://github.com/newrelic/newrelic-ruby-agent/pull/2078)

## v9.2.2

Version 9.2.2 of the agent fixes a bug with the `Transaction#finished?` method.
Expand Down
8 changes: 4 additions & 4 deletions lib/new_relic/agent/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def call(severity, time, progname, msg)
message << CLOSING_BRACE << NEWLINE
end

def clear_tags!
# No-op; just avoiding issues with act-fluent-logger-rails
end

private

def add_app_name(message)
Expand Down Expand Up @@ -138,10 +142,6 @@ def escape(message)
end
message.to_json
end

def clear_tags!
# No-op; just avoiding issues with act-fluent-logger-rails
end
end

# This logger decorates logs with trace and entity metadata, and emits log
Expand Down
5 changes: 5 additions & 0 deletions test/new_relic/agent/logging_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ def last_message
JSON.load(@output.string.split("\n")[-1])
end

def test_clear_tags_is_called_without_error
logger = DecoratingLogger.new(@output)
logger.formatter.clear_tags!
end

def test_log_to_json
logger = DecoratingLogger.new(@output)
logger.info('this is a test')
Expand Down