Skip to content

Commit

Permalink
Add log instructions for Lograge users
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Jul 26, 2024
1 parent f72d19f commit 5556c68
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -2505,10 +2505,23 @@ In many cases, such as logging, it may be useful to correlate trace IDs to other
##### Automatic
For Rails applications using the default logger (`ActiveSupport::TaggedLogging`), `lograge` or `semantic_logger`, trace correlation injection is enabled by default.
For Rails applications using the default logger (`ActiveSupport::TaggedLogging`), `lograge`, or `semantic_logger`, trace correlation injection is enabled by default.
It can be disabled by setting the environment variable `DD_LOGS_INJECTION=false`.
<div class="alert alert-warning">
If using <code>lograge</code>, disable <code>ActiveSupport::TaggedLogging</code> to prevent plain-text <code>TaggedLogging</code> tags from polluting the log lines.
</div>
To disable `ActiveSupport::TaggedLogging`, in your Rails configuration, set:
```ruby
config.logger = ActiveSupport::Logger.new(STDOUT)
config.active_job.logger = ActiveSupport::Logger.new(STDOUT)
```
This is not necessary when using `semantic_logger`.
#### For logging in Ruby applications
To add correlation IDs to your logger, add a log formatter which retrieves the correlation IDs with `Datadog::Tracing.correlation`, then add them to the message.
Expand Down

0 comments on commit 5556c68

Please sign in to comment.