I am seeing Elixir Crash Logs on Console but they are not being logged to the log file.
I have tried setting the config:
config :logger,
handle_otp_reports: true,
handle_sasl_reports: true,
compile_time_purge_level: :info,
backends: [:console, LogToLager],
level: :info,
utc_log: true
I expect the crash reports to go to the log file as well along with console. I am using lager to log. Here's lagers config:
config :lager,
level: :info,
async_threshold: 500,
async_threshold_window: 50,
log_root: '/log/path',
handlers: [ lager_console_backend: :info ],
extra_sinks: [
dispatcher_lager_event: [
handlers: [
lager_file_backend: [
file: String.to_charlist("beam@" <> System.get_env("COMPUTERNAME") <> ".log"),
level: :info,
size: 100 * 1024 * 1024,
date: '$D0',
count: 10
]
]
]
]
Given lager config has
extra_sinksspecified with a customdispatcher_lager_eventsink name, I am assumingLogToLagerusesdispatcher_lager_eventto dispatchlagerlogs.That said, I've replicated your setup with a custom lager backend module, inspired by
LoggerLagerBackendmodule fromlogger_lager_backendpackage:Having the following contents in
config/config.exs:I open
iexand runTask.async(fn -> 1 / 0 end), which produces a crash report in the console:...as well in my
my_custom_file.log: