Last active
March 25, 2020 13:56
-
-
Save nimish-mehta/065cca534ace3eb55ed9f50e78963f74 to your computer and use it in GitHub Desktop.
Configure Logging to File in Phoenix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configures Elixir's Logger to log to file | |
# ensure https://github.com/onkel-dirtus/logger_file_backend | |
# is installed in deps of the project in mix.exs | |
# reuses the original phoenix logging format. | |
config :logger, backends: [{LoggerFileBackend, :request_log}], | |
format: "$time $metadata[$level] $message\n", | |
metadata: [:request_id] | |
# Keep a seperate log file for each env. | |
# logs are stored in the root directory of the application | |
# inside the logs folder. | |
# Note: Remember to specify the format along with the metadata required. | |
# Configurable per LoggerFileBackend. | |
config :logger, :request_log, | |
path: "logs/request.#{Mix.env}.log", | |
format: "$time $metadata[$level] $message\n", | |
metadata: [:request_id] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment