Configure Logging
You do not need to create a log source to send logs from the AppSignal for Elixir integration. An “application” log source will be created automatically.Logger Handler
You can configure the Erlang:logger to use the Appsignal.Logger.Handler module as a handler, by calling the Appsignal.Logger.Handler.add/2 function on your Application.start/2 callback:
Logger Backend
Instead of using an Elixir logger handler, you can configure the Elixir logger backend to use theAppsignal.Logger.Backend module as a backend by placing the code below in the config/runtime.exs file:
group option describes where you are logging from. This group name can be used in AppSignal to filter your logs.
You can also add the backend using the add_backend/2 function on your Application.start/2 callback:
Elixir Logger
To send logs to AppSignal without using the Elixir Logger backend, you can use one ofAppsignal.Logger’s logging functions and provide it with a groupname that defines where you are logging from. For example, if we were logging from a helper for invoicing clients:
Usage
Sending Logs
Like the Elixir/Phoenix logger class, you can define the severity level of your logs by usingfatal, error, warning, info, and debug:
Formats
Auto detected format
The AppSignal for Elixir package will automatically detect the log line’s format as JSON, Logfmt or plaintext by default, and parse attributes from it. You don’t need to manually set the log format, unless it’s not being detected properly. Please also notify us if this isn’t working automatically.Logfmt
The AppSignal Logger can be explicitly configured to expect the line to be formatted as Logfmt and parse attributes from it. Use this option when using an older AppSignal for Elixir package version, which does not support automatic format detection. The Logfmt format can be specified when the AppSignal logger is called by adding the:logfmt value as the last argument.
JSON
The AppSignal Logger can be explicitly configured to expect the line to be formatted as JSON and parse attributes from it. Use this option when using an older AppSignal for Elixir package version, which does not support automatic format detection. The JSON format can be specified when the AppSignal logger is called by adding the:json value as the last argument.
null) will be shown as log attributes. All other attributes will be discarded.
Filtering Logs
You can use theignore_logs configuration option to ignore log lines based on their message. See our Ignore Logs guide to learn more.