[erlang-questions] Erlang 21 Logger Configuration
Steve Strong
steve@REDACTED
Tue Mar 19 11:56:44 CET 2019
Hi All,
Quick question regarding the handling of configuration changes for the disk_log hander in the new Logger framework, and specifically how it handles max_no_bytes.
Given a clean directory, I can do the following:
> erl
Erlang/OTP 21 [erts-10.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
Eshell V10.3 (abort with ^G)
1> logger:add_handler(disk_log, logger_disk_log_h, #{config => #{file => "log/debug.log", type => wrap, max_no_files => 10, max_no_bytes => 10000}, level => all}).
ok
2>q().
That creates me a log folder with a debug.log.1, debug.log.idx and debug.log.siz. If I then start a new shell and try to create the handler but with a different max_no_bytes, I get the following:
> erl
Erlang/OTP 21 [erts-10.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
Eshell V10.3 (abort with ^G)
1> logger:add_handler(disk_log, logger_disk_log_h, #{config => #{file => "log/debug.log", type => wrap, max_no_files => 10, max_no_bytes => 15000}, level => all}).
{error,{handler_not_added,{size_mismatch,{10000,10},
{15000,10}}}}
2> q().
Due to the change in the max_no_bytes parameter, the handler fails to start. What is the recommended way to deal with adjusting config value such as this, particularly for handlers that may be added / removed dynamically? Right now, we are needing to archive the entire log directory prior to changing values, which is a real pain.
Cheers,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190319/b3dcaff1/attachment.htm>
More information about the erlang-questions
mailing list