Skip to content

Commit

Permalink
Merge pull request #2078 from newrelic/2077_log_decorating_formatter_…
Browse files Browse the repository at this point in the history
…clear_tags

Fix for incorrectly private method in DecoratingFormatter
  • Loading branch information
tannalynn authored Jun 14, 2023
2 parents 8794baa + 2ba7431 commit 706ea67
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
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**

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

0 comments on commit 706ea67

Please sign in to comment.