Logging From ElixirBETA

AppSignal for ElixirThis feature requires 2.6.0 or higher.

This documentation outlines how to configure logging with your AppSignal for Elixir integration.

mix deps.update appsignal

Configure Logging

Your log data must not contain any personal data, such as names, email addresses, etc. It is your responsibility to ensure this data is filtered out before being sent to AppSignal, and when identifying a person is necessary that your application uses alternative forms of identification such as a user ID, hash, or pseudonym.

Logger backend

You can configure the Elixir Logger to use the Appsignal.Logger.Backend module as a backend by placing the code below in the config/runtime.exs file:

config :logger, :backends, [:console, {Appsignal.Logger.Backend, [group: "phoenix"]}]

The group attribute describes where you are logging from and can be used in AppSignal to filter your logs. Note that you need to add the :console shortcut for the default console logger if you also want your logs to be printed to the console.

You can also add the backend using the add_backend/2 function on your Application.start/2 callback:

@impl true def start(_type, _args) do Logger.add_backend(Appsignal.Logger.Backend, group: "phoenix")

Elixir Logger

To send logs to AppSignal without using the Elixir Logger backend, you can use one of Appsignal.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:

Appsignal.Logger.info("invoice_helper", "Generating invoice for customer 129.")


Sending Logs

Like the Elixir/Phoenix logger class, you can define the severity level of your logs by using unknown, fatal, error, warning, info, and debug:

Appsignal.Logger.warning("app", "Something's gone terribly wrong here")

You can define custom attributes to send log information that can be used when filtering and querying logs:

Appsignal.Logger.info("invoice_helper", "Generated invoice for customer #{customer.id}", %{ customer_id: customer.id, invoice_id: invoice.id})

You can query and filter on message contents and attribute values from within the Log Management tool.

Once configured, the desired attributes will be sent to AppSignal as log_tags, and be queryable in the AppSignal logging interface.


The log format can be specified when attaching the logger backend. For Logfmt:

config :logger, :backends, [{Appsignal.Logger.Backend, [group: "phoenix", format: "logfmt"]}]


LogfmtEx is a custom logfmt format for Elixir.

After adding the logfmt_ex package update your config/runtime.exs to output all logs in logfmt format, like in the example below:

config :logger, :console, format: {LogfmtEx, :format}

Need Help?

After configuring your Elixir application to send logs, logs should appear in AppSignal. If you are unsure about this step or AppSignal is not receiving any logs, you can always reach out for assistance. We'll help get you back on track!