Problem Statement
Hey folks, now with the new TelemetryProcessor in place, I'm a bit confused as to whether we still need to add the :logger.add_handler/3 in the application. In the auto-setup for logs PR #998, you mention that manually adding the logger is no longer necessary but the docs don't clarify that yet.
I ran into this confusion because I've added new metadata to my log events and they show in my logs, but they don't show up in the Sentry logs UI (Discover > Logs > Click on a log row). Here's my setup:
I've recently upgraded to the latest 12.0.3 version and added the enable_logs: true flag and telemetry_processor_categories: [:log, :error, :check_in, :transaction] as described in the Changelog. I left my :logger.add_handler/3 in my application.ex because the Changelog did not specify that it needs removing. My Logger.error("foobar") calls still got logged in Sentry so all was well.
Now, I've added new metadata to my log events and they show up when I view my logs on my server, but they don't show in the Sentry Logs UI. I haven't had an error after making this change, so I can't tell whether the new metadata shows up in the regular Sentry error events.
In my application.ex, I have now:
def start(_type, _args) do
:logger.add_handler(:sentry_error_log_handler, Sentry.LoggerHandler, %{
config: %{metadata: :all, capture_log_messages: true, level: :error}
})
# ...
end
# config/prod.exs
config :sentry,
dsn: "my-dsn",
environment_name: Mix.env(),
enable_source_code_context: true,
root_source_code_paths: [File.cwd!()],
enable_logs: true,
telemetry_processor_categories: [:log, :error, :check_in, :transaction],
integrations: [
telemetry: [
report_handler_failures: true
],
oban: [
capture_errors: true,
cron: [enabled: true]
]
]
So, my questions are:
- Do we still need to add
:logger.add_handler/3 if we add enable_logs: true to our Sentry config?
- If not, how do we configure the logs (e.g.
level, metadata, capture_log_messages: true) and are the configuration options the same as for the Sentry.LoggerHandler?
- How can we still create Sentry Error events for
Logger.error/1 calls but not for Logger.info/1 calls?
Solution Brainstorm
No response
Problem Statement
Hey folks, now with the new
TelemetryProcessorin place, I'm a bit confused as to whether we still need to add the:logger.add_handler/3in the application. In the auto-setup for logs PR #998, you mention that manually adding the logger is no longer necessary but the docs don't clarify that yet.I ran into this confusion because I've added new metadata to my log events and they show in my logs, but they don't show up in the Sentry logs UI (
Discover > Logs > Click on a log row). Here's my setup:I've recently upgraded to the latest
12.0.3version and added theenable_logs: trueflag andtelemetry_processor_categories: [:log, :error, :check_in, :transaction]as described in the Changelog. I left my:logger.add_handler/3in myapplication.exbecause the Changelog did not specify that it needs removing. MyLogger.error("foobar")calls still got logged in Sentry so all was well.Now, I've added new metadata to my log events and they show up when I view my logs on my server, but they don't show in the Sentry Logs UI. I haven't had an error after making this change, so I can't tell whether the new metadata shows up in the regular Sentry error events.
In my
application.ex, I have now:So, my questions are:
:logger.add_handler/3if we addenable_logs: trueto our Sentry config?level, metadata, capture_log_messages: true) and are the configuration options the same as for theSentry.LoggerHandler?Logger.error/1calls but not forLogger.info/1calls?Solution Brainstorm
No response