diff options
author | Siri Hansen <[email protected]> | 2018-05-18 11:54:32 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2018-05-23 11:11:13 +0200 |
commit | be959158a9ebe4b4ed8c336b969ac0c0e9399312 (patch) | |
tree | 1961fcf517dde4d42e7dd59a9803eaff89842d59 /lib/kernel/src | |
parent | a9a6b803a60793d42a74e0f1693a7594dffb6bc3 (diff) | |
download | otp-be959158a9ebe4b4ed8c336b969ac0c0e9399312.tar.gz otp-be959158a9ebe4b4ed8c336b969ac0c0e9399312.tar.bz2 otp-be959158a9ebe4b4ed8c336b969ac0c0e9399312.zip |
Set legacy_header=true for kernel's default handler only
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/logger.erl | 10 | ||||
-rw-r--r-- | lib/kernel/src/logger_h_common.erl | 2 | ||||
-rw-r--r-- | lib/kernel/src/logger_internal.hrl | 3 | ||||
-rw-r--r-- | lib/kernel/src/logger_server.erl | 2 |
4 files changed, 12 insertions, 5 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl index 281521ae6e..51743822af 100644 --- a/lib/kernel/src/logger.erl +++ b/lib/kernel/src/logger.erl @@ -677,7 +677,8 @@ init_default_config(Type) when Type==standard_io; Type==standard_error; element(1,Type)==file -> Env = get_logger_env(), - DefaultConfig = #{logger_std_h=>#{type=>Type}}, + DefaultFormatter = #{formatter=>{?DEFAULT_FORMATTER,?DEFAULT_FORMAT_CONFIG}}, + DefaultConfig = DefaultFormatter#{logger_std_h=>#{type=>Type}}, NewLoggerEnv = case lists:keyfind(default, 2, Env) of {handler, default, Module, Config} -> @@ -687,6 +688,13 @@ init_default_config(Type) when Type==standard_io; %% if not configured by user AND the default %% handler is still the logger_std_h. {handler, default, Module, maps:merge(DefaultConfig,Config)}; + ({handler, default, logger_disk_log_h, _}) -> + %% Add default formatter. The point of this + %% is to get the expected formatter config + %% for the default handler, since this + %% differs from the default values that + %% logger_formatter itself adds. + {handler, default, logger_disk_log_h, maps:merge(DefaultFormatter,Config)}; (Other) -> Other end, Env); diff --git a/lib/kernel/src/logger_h_common.erl b/lib/kernel/src/logger_h_common.erl index 901c4c0dad..70531c0e34 100644 --- a/lib/kernel/src/logger_h_common.erl +++ b/lib/kernel/src/logger_h_common.erl @@ -72,7 +72,7 @@ try_format(Log,Formatter,FormatterConfig) -> {log,Log}, {reason, {C,R,logger:filter_stacktrace(?MODULE,S)}}]), - case {?DEFAULT_FORMATTER,?DEFAULT_FORMAT_CONFIG} of + case {?DEFAULT_FORMATTER,#{}} of {Formatter,FormatterConfig} -> "DEFAULT FORMATTER CRASHED"; {DefaultFormatter,DefaultConfig} -> diff --git a/lib/kernel/src/logger_internal.hrl b/lib/kernel/src/logger_internal.hrl index f9377259f3..97ef4abfa4 100644 --- a/lib/kernel/src/logger_internal.hrl +++ b/lib/kernel/src/logger_internal.hrl @@ -31,8 +31,7 @@ {no_domain,{fun logger_filters:domain/2,{log,no_domain,[]}}}]). -define(DEFAULT_FORMATTER,logger_formatter). -define(DEFAULT_FORMAT_CONFIG,#{legacy_header=>true, - single_line=>false, - template=>?DEFAULT_FORMAT_TEMPLATE_HEADER}). + single_line=>false}). -define(DEFAULT_FORMAT_TEMPLATE_HEADER, [{logger_formatter,header},"\n",msg,"\n"]). -define(DEFAULT_FORMAT_TEMPLATE_SINGLE, diff --git a/lib/kernel/src/logger_server.erl b/lib/kernel/src/logger_server.erl index 275b9c476f..67befef156 100644 --- a/lib/kernel/src/logger_server.erl +++ b/lib/kernel/src/logger_server.erl @@ -328,7 +328,7 @@ default_config(_) -> #{level=>info, filters=>[], filter_default=>log, - formatter=>{?DEFAULT_FORMATTER,?DEFAULT_FORMAT_CONFIG}}. + formatter=>{?DEFAULT_FORMATTER,#{}}}. sanity_check(Owner,Key,Value) -> sanity_check_1(Owner,[{Key,Value}]). |