diff --git a/eRum.sample.config b/eRum.sample.config index 9fed749..a661025 100644 --- a/eRum.sample.config +++ b/eRum.sample.config @@ -1,6 +1,6 @@ [ {eRum, [ - + %% ******************************************** 颜色打印相关 ***************************************************** %% 是否开启颜色 {colored, false}, %% 颜色码配置 @@ -15,42 +15,77 @@ {emergency, "\e[1;41m"} ]}, + %%*********************************************** 异步日志相关 ***************************************************** + %% 异步切换到同步时模式gen_event邮箱的最大消息数,此值仅应用于默认接收器; 额外的接收器也可以自己配置。 + {async_threshold, 20}, + %%当gen_event 邮箱大小从 async_threshold 减小到 async_threshold-async_threshold_window 时,切换回异步模式。 + %% 此值仅适用于默认接收器。额外的接收器可以自己配置。 + {async_threshold_window, 5}, + + %%*********************************************** handler与接收器(sink) ***************************************** + %% 消息处理模块可以存在多个,[{Name, [Optins]}]=Handler() {lager_file_backend, [{file, "console.log"}, {level, info}]} 消息处理模块可以存在多个 + {handlers, []}, + %% 额外的接收器名字列表 [atom()] + {larger_extra_sikns, []}, + %% 额外的接收器列表 [{handler, [Handler()]}] + {extra_sinks, []}, + %% 限制每秒允许的消息数量 最好将此数字保持较小 + {error_logger_hwm, 50}, + + %% ********************************************** 日志文件配置相关 ************************************************ + %% 可选的日志路径, 默认情况下是当前路径 + {log_root, "./log"}, + %% crash log cfg %% 有效值 string | false %% 为 false 的时候 没有 crash logger. {crash_log, "log/crash.log"}, - - %% Maximum size in bytes of events in the crash log - defaults to 65536 + %%崩溃日志中事件的最大大小(以字节为单位)-默认为65536 {crash_log_msg_size, 65536}, - - %% Maximum size of the crash log in bytes, before its rotated, set to 0 to disable rotation - default is 0 + %% 崩溃日志的最大大小(以字节为单位),在旋转之前,设置为0以禁用旋转-默认值为0 {crash_log_size, 10485760}, - - %% What time to rotate the crash log - default is no time rotation. See the README for a description of this format. + %% 什么时间轮换崩溃日志-默认为无时间轮换。有关此格式的说明,请参见自述文件。 {crash_log_date, "$D0"}, - - %% Number of rotated crash logs to keep, 0 means keep only the current one - default is 0 + %% 要保留的已轮转崩溃日志的数量,0表示仅保留当前的一个-默认值为0 {crash_log_count, 5}, - - %% Crash Log Rotator Module - default is lager_rotator_default + %% 崩溃日志旋转器模块-默认为lager_rotator_default {crash_log_rotator, lager_rotator_default}, - %% Whether to redirect error_logger messages into the default lager_event sink - defaults to true - {error_logger_redirect, true}, - - %% How many messages per second to allow from error_logger before we start dropping them + %% ********************************************** error_logger相关 ********************************************** + %% 是否将error_logger消息重定向到默认的lager_event接收器-默认为true + {error_logger_redirect, false}, + %% 列表中的handler 不会处理error_logger + {error_logger_whitelist, []}, + %% 每秒允许来自error_logger的消息数量是多少 超过就丢弃掉 {error_logger_hwm, 50}, - %% How big the gen_event mailbox can get before it is - %% switched into sync mode. This value only applies to - %% the default sink; extra sinks can supply their own. - {async_threshold, 20}, + %% 对于特定的接收器事件队列刷新,请使用改选项 + {flush_queue, true}, + %% 对于接收器 如果flush_queue为true,则可以设置消息队列长度阈值,在该阈值处将开始丢弃消息。默认阈值为0, + %% 这意味着如果flush_queue为true,则超过高水位标记时将丢弃消息,而不管消息队列的长度如何。: + {flush_threshold, 1000}, + %% 超过高水位标记时,可以将啤酒配置为刷新消息队列中的所有事件通知 + {error_logger_flush_queue, true}, + %% 如果flush_queue为true,则可以设置消息队列长度阈值,在该阈值处将开始丢弃消息。默认阈值为0,这意味着如果flush_queue为true, + %% 则超过高水位标记时将丢弃消息,而不管消息队列的长度如何。用于控制阈值的选项是error_logger: + {error_logger_flush_threshold, 20}, + + %% ********************************************** killer相关 **************************************************** + %% 如果接收器的邮箱大小超过1000条消息,请杀死整个接收器并在5000毫秒后重新加载它。如果需要,此行为也可以安装到其他水槽中。 + {killer_hwm, 1000}, + %% 参见killer_hwm + {killer_reinstall_after, 5000}, + + %% ********************************************** app启动停止监听相关 ********************************************* + %% 如果您不想在应用程序的调试级别看到主管和应用程序启动/停止日志,则可以使用以下配置将其关闭: + {suppress_application_start_stop, true}, + {suppress_supervisor_start_stop, true} - %% Switch back to async mode, when gen_event mailbox size - %% decrease from `async_threshold' to async_threshold - - %% async_threshold_window. This value only applies to the - %% default sink; extra sinks can supply their own. - {async_threshold_window, 5} + %% **********************************************其他备注 ******************************************************** + %%Lager默认将消息截断为4096字节,您可以使用该{lager_truncation_size, X}选项进行更改。在钢筋中,您可以将其添加到 erl_opts: + %%{ erl_opts,[{ parse_transform,lager_transform },{ lager_truncation_size,1024 }]}。 + %%erlc如果您愿意,也可以将其传递给, + %%erlc -pa lager/ebin +'{parse_transform, lager_transform}' +'{lager_truncation_size, 1024}' file.erl ]} ]. diff --git a/整理note.md b/整理note.md deleted file mode 100644 index b192f97..0000000 --- a/整理note.md +++ /dev/null @@ -1,43 +0,0 @@ -配置选项整理 ----------- -log_root string() "/var/log" 可选的日志路径, 默认情况下是当前路径 -handlers [{Name, [Optins]}]=Handler() {lager_file_backend, [{file, "console.log"}, {level, info}]} 消息处理模块可以存在多个 -larger_extra_sikns [atom()] [audit] 额外的接收器名字列表 -extra_sinks [{handler, [Handler()]}] 额外的接收器列表 -async_threshold integer()|undefined 20 异步消息最大数 如果为undefiend禁用异步消息 -async_threshold_window integer() 5 这将使用异步消息传递,直到邮箱超过20条消息为止,此时将使用同步消息传递,并在大小减小为时切换回异步20 - 5 = 15。 -error_logger_hwm integer() 50 限制每秒允许的消息数量 最好将此数字保持较小 - -flush_queue boolean() true 对于特定的接收器事件队列刷新,请使用改选项 -flush_threshold integer() 1000 对于接收器 如果flush_queue为true,则可以设置消息队列长度阈值,在该阈值处将开始丢弃消息。默认阈值为0,这意味着如果flush_queue为true,则超过高水位标记时将丢弃消息,而不管消息队列的长度如何。: -error_logger_flush_queue boolean() true 超过高水位标记时,可以将啤酒配置为刷新消息队列中的所有事件通知 -error_logger_flush_threshold integer() 20 如果flush_queue为true,则可以设置消息队列长度阈值,在该阈值处将开始丢弃消息。默认阈值为0,这意味着如果flush_queue为true,则超过高水位标记时将丢弃消息,而不管消息队列的长度如何。用于控制阈值的选项是error_logger: -error_logger_redirect boolean() false 禁用错误记录器集成 -error_logger_whitelist list() [one_handler] 列表中的handler 不会处理error_logger - -crash_log_msg_size integer() 5000 指定崩溃日志最大的消息大小 - -killer_hwm integer() 1000 如果接收器的邮箱大小超过1000条消息,请杀死整个接收器并在5000毫秒后重新加载它。如果需要,此行为也可以安装到其他水槽中。 -killer_reinstall_after integer() 5000 参见killer_hwm - - -colored boolean() true 是否开启颜色 - -如果您不想在应用程序的调试级别看到主管和应用程序启动/停止日志,则可以使用以下配置将其关闭: - -suppress_application_start_stop,true}, -suppress_supervisor_start_stop,true}]} - - - -%% -Lager默认将消息截断为4096字节,您可以使用该{lager_truncation_size, X}选项进行更改。在钢筋中,您可以将其添加到 erl_opts: - -{ erl_opts,[{ parse_transform,lager_transform },{ lager_truncation_size,1024 }]}。 -erlc如果您愿意,也可以将其传递给, - -erlc -pa lager/ebin +'{parse_transform, lager_transform}' +'{lager_truncation_size, 1024}' file.erl - - - -