Logging From Elixir
Configure Package
To use logging with your AppSignal integration for Elixir, you first need to install version 2.4
of the package or higher.
Use Logging
Once the logging branch has been successfully installed, your Elixir integration will include a new Appsignal.Logger
module, which provides eight functions.
Each of these functions correspond to the severity of the log message:
debug/3
,info/3
,notice/3
,warning/3
,error/3
,critical/3
,alert/3
,emergency/3
These functions accept three arguments in the following order: group
, message
, and optionally metadata
. The examples below show how you can use these arguments in your application when creating new logs:
Appsignal.Logger.debug("app", "Log message line")
Appsignal.Logger.debug("app", "Something went wrong with customer: #{customer_id}", %{customer_id: 123, post_id: 234})
You can query and filter on message contents and attribute values from within the Log Management tool.
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!