aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-05-21 16:47:46 +0200
committerSiri Hansen <[email protected]>2018-05-23 11:11:44 +0200
commitd35c100a10239edc669b465a2176000ffcc1300f (patch)
tree6a8c158a14d10fd092970b4e73da2b4cd74535b8
parente484181ecc5c3e2928d10632138837eba3c3229e (diff)
downloadotp-d35c100a10239edc669b465a2176000ffcc1300f.tar.gz
otp-d35c100a10239edc669b465a2176000ffcc1300f.tar.bz2
otp-d35c100a10239edc669b465a2176000ffcc1300f.zip
Change Compare parameter to logger_filters:domain/2
This configuration option has been removed. logger_formatter will read the utc_log configuration parameter and format the timestamp accordingly.
-rw-r--r--lib/kernel/doc/src/logger.xml4
-rw-r--r--lib/kernel/doc/src/logger_chapter.xml2
-rw-r--r--lib/kernel/doc/src/logger_filters.xml145
-rw-r--r--lib/kernel/src/logger_filters.erl24
-rw-r--r--lib/kernel/src/logger_internal.hrl4
-rw-r--r--lib/kernel/test/logger_env_var_SUITE.erl28
-rw-r--r--lib/kernel/test/logger_filters_SUITE.erl134
-rw-r--r--lib/kernel/test/logger_legacy_SUITE.erl4
-rw-r--r--lib/sasl/src/sasl.erl13
9 files changed, 195 insertions, 163 deletions
diff --git a/lib/kernel/doc/src/logger.xml b/lib/kernel/doc/src/logger.xml
index e2f3dd6e83..6e50473fa8 100644
--- a/lib/kernel/doc/src/logger.xml
+++ b/lib/kernel/doc/src/logger.xml
@@ -421,10 +421,10 @@ Current logger configuration:
Config: stop
Id: domain
Fun: fun logger_filters:domain/2
- Config: {log,prefix_of,[beam,erlang,otp,sasl]}
+ Config: {log,super,[beam,erlang,otp,sasl]}
Id: no_domain
Fun: fun logger_filters:domain/2
- Config: {log,no_domain,[]}
+ Config: {log,undefined,[]}
Handler Config:
logger_std_h: #{type => standard_io}
Level set per module:
diff --git a/lib/kernel/doc/src/logger_chapter.xml b/lib/kernel/doc/src/logger_chapter.xml
index fd86e9e366..34c65be47a 100644
--- a/lib/kernel/doc/src/logger_chapter.xml
+++ b/lib/kernel/doc/src/logger_chapter.xml
@@ -594,7 +594,7 @@
except the former so called "SASL reports", look the same as
before.</p>
</item>
- <tag>SASL Reports</tag>
+ <tag><marker id="sasl_reports"/>SASL Reports</tag>
<item>
<p>By SASL reports we mean supervisor reports, crash reports
and progress reports.</p>
diff --git a/lib/kernel/doc/src/logger_filters.xml b/lib/kernel/doc/src/logger_filters.xml
index 1bbae8be21..f92181ea3f 100644
--- a/lib/kernel/doc/src/logger_filters.xml
+++ b/lib/kernel/doc/src/logger_filters.xml
@@ -52,61 +52,100 @@
<funcs>
<func>
<name name="domain" arity="2"/>
- <fsummary>Filter log events based on the domain field in metadata.</fsummary>
+ <fsummary>Filter log events based on the domain field in
+ metadata.</fsummary>
<desc>
- <p>This filter provides a way of filtering log events based on a
- <c>domain</c> field <c>Metadata</c>.</p>
-
- <p>The <c><anno>Extra</anno></c> parameter is specified when
- adding the filter
- via <seealso marker="logger#add_logger_filter-2">
- <c>logger:add_logger_filter/2</c></seealso>
- or <seealso marker="logger#add_handler_filter-3">
- <c>logger:add_handler_filter/3</c></seealso>.</p>
-
- <p>The filter compares the value of the <c>domain</c> field
- in the log event's metadata (<c>Domain</c>)
- to <c><anno>MatchDomain</anno></c> as follows:</p>
-
- <taglist>
- <tag><c><anno>Compare</anno> = starts_with</c></tag>
- <item><p>The filter matches if <c>MatchDomain</c> is a prefix
- of <c>Domain</c>.</p></item>
- <tag><c><anno>Compare</anno> = prefix_of</c></tag>
- <item><p>The filter matches if <c>Domain</c> is a prefix
- of <c>MatchDomain</c>.</p></item>
- <tag><c><anno>Compare</anno> = equals</c></tag>
- <item><p>The filter matches if <c>Domain</c> is equal
- to <c>MatchDomain</c>.</p></item>
- <tag><c><anno>Compare</anno> = differs</c></tag>
- <item><p>The filter matches if <c>Domain</c> differs
- from <c>MatchDomain</c>, or if there is no domain field
- in metadata.</p></item>
- <tag><c><anno>Compare</anno> = no_domain</c></tag>
- <item><p>The filter matches if there is no domain field in
- metadata. In this case <c><anno>MatchDomain</anno></c> shall
- be <c>[]</c>.</p></item>
- </taglist>
-
- <p>If the filter matches and <c><anno>Action</anno> =
- log</c>, the log event is allowed. If the filter matches
- and <c><anno>Action</anno> = stop</c>, the log event is
- stopped.</p>
-
- <p>If the filter does not match, it returns <c>ignore</c>,
- meaning that other filters, or the value of the
- configuration parameter <c>filter_default</c>, will decide
- if the event is allowed or not.</p>
-
- <p>Log events that do not contain any domain field, will
- only match when <c><anno>Compare</anno> = no_domain</c>.</p>
-
- <p>Example: stop all events with
- domain <c>[beam,erlang,otp,sasl|_]</c></p>
-
- <code>
+ <p>This filter provides a way of filtering log events based on a
+ <c>domain</c> field in <c>Metadata</c>. This field is
+ optional, and the purpose of using it is to group log events
+ from, for example, a specific functional area. This allows
+ filtering or other specialized treatment in a Logger
+ handler.</p>
+
+ <p>A domain field must be a list of atoms, creating smaller
+ and more specialized domains as the list grows longer. The
+ biggest domain is <c>[]</c>, which comprices all
+ possible domains.</p>
+
+ <p>For example, consider the following domains:</p>
+ <pre>
+D1 = [beam,erlang,otp]
+D2 = [beam,erlang,otp,sasl]</pre>
+
+ <p><c>D1</c> is the biggest of the two, and is said to be a
+ super-domain of <c>D2</c>. <c>D2</c> is a
+ sub-domain <c>D1</c>. Both <c>D1</c> and <c>D2</c> are
+ sub-domains of <c>[]</c></p>
+
+ <p>The above domains are used for logs originating from
+ Erlang/OTP. D1 specifies that the log event comes from
+ Erlang/OTP in general, and D2 indicates that the log event
+ is a so
+ called <seealso marker="logger_chapter#sasl_reports">SASL
+ report</seealso>.</p>
+
+ <p>The <c><anno>Extra</anno></c> parameter to
+ the <c>domain/2</c> function is specified when adding the
+ filter via <seealso marker="logger#add_logger_filter-2">
+ <c>logger:add_logger_filter/2</c></seealso>
+ or <seealso marker="logger#add_handler_filter-3">
+ <c>logger:add_handler_filter/3</c></seealso>.</p>
+
+ <p>The filter compares the value of the <c>domain</c> field
+ in the log event's metadata (<c>Domain</c>)
+ to <c><anno>MatchDomain</anno></c> as follows:</p>
+
+ <taglist>
+ <tag><c><anno>Compare</anno> = sub</c></tag>
+ <item>
+ <p>The filter matches if <c>Domain</c> is equal to or
+ a sub-domain of <c>MatchDomain</c>, that is,
+ if <c>MatchDomain</c> is a prefix of <c>Domain</c>.</p>
+ </item>
+ <tag><c><anno>Compare</anno> = super</c></tag>
+ <item>
+ <p>The filter matches if <c>Domain</c> is equal to or a
+ super-domain of <c>MatchDomain</c>, that is,
+ if <c>Domain</c> is a prefix of <c>MatchDomain</c>.</p>
+ </item>
+ <tag><c><anno>Compare</anno> = equal</c></tag>
+ <item>
+ <p>The filter matches if <c>Domain</c> is equal
+ to <c>MatchDomain</c>.</p>
+ </item>
+ <tag><c><anno>Compare</anno> = not_equal</c></tag>
+ <item>
+ <p>The filter matches if <c>Domain</c> is not equal
+ to <c>MatchDomain</c>, or if there is no domain field in
+ metadata.</p>
+ </item>
+ <tag><c><anno>Compare</anno> = undefined</c></tag>
+ <item><p>The filter matches if there is no domain field in
+ metadata. In this case <c><anno>MatchDomain</anno></c>
+ must be set to <c>[]</c>.</p>
+ </item>
+ </taglist>
+
+ <p>If the filter matches and <c><anno>Action</anno> = log</c>,
+ the log event is allowed. If the filter matches
+ and <c><anno>Action</anno> = stop</c>, the log event is
+ stopped.</p>
+
+ <p>If the filter does not match, it returns <c>ignore</c>,
+ meaning that other filters, or the value of the
+ configuration parameter <c>filter_default</c>, decide if the
+ event is allowed or not.</p>
+
+ <p>Log events that do not contain any domain field, match only
+ when <c><anno>Compare</anno> = undefined</c>
+ or <c><anno>Compare</anno> = not_equal</c>.</p>
+
+ <p>Example: stop all events with
+ domain <c>[beam,erlang,otp,sasl|_]</c></p>
+
+ <code>
logger:set_handler_config(h1,filter_default,log). % this is the default
-Filter = {fun logger_filters:domain/2,{stop,starts_with,[beam,erlang,otp,sasl]}}.
+Filter = {fun logger_filters:domain/2,{stop,sub,[beam,erlang,otp,sasl]}}.
logger:add_handler_filter(h1,no_sasl,Filter).
ok</code>
</desc>
diff --git a/lib/kernel/src/logger_filters.erl b/lib/kernel/src/logger_filters.erl
index 592ff28cc2..322aa0265d 100644
--- a/lib/kernel/src/logger_filters.erl
+++ b/lib/kernel/src/logger_filters.erl
@@ -31,15 +31,15 @@
Log :: logger:log(),
Extra :: {Action,Compare,MatchDomain},
Action :: log | stop,
- Compare :: prefix_of | starts_with | equals | no_domain,
+ Compare :: super | sub | equal | not_equal | undefined,
MatchDomain :: list(atom()).
domain(#{meta:=Meta}=Log,{Action,Compare,MatchDomain})
when ?IS_ACTION(Action) andalso
- (Compare==prefix_of orelse
- Compare==starts_with orelse
- Compare==equals orelse
- Compare==differs orelse
- Compare==no_domain) andalso
+ (Compare==super orelse
+ Compare==sub orelse
+ Compare==equal orelse
+ Compare==not_equal orelse
+ Compare==undefined) andalso
is_list(MatchDomain) ->
filter_domain(Compare,Meta,MatchDomain,on_match(Action,Log));
domain(Log,Extra) ->
@@ -82,18 +82,18 @@ remote_gl(Log,Action) ->
%%%-----------------------------------------------------------------
%%% Internal
-filter_domain(prefix_of,#{domain:=Domain},MatchDomain,OnMatch) ->
+filter_domain(super,#{domain:=Domain},MatchDomain,OnMatch) ->
is_prefix(Domain,MatchDomain,OnMatch);
-filter_domain(starts_with,#{domain:=Domain},MatchDomain,OnMatch) ->
+filter_domain(sub,#{domain:=Domain},MatchDomain,OnMatch) ->
is_prefix(MatchDomain,Domain,OnMatch);
-filter_domain(equals,#{domain:=Domain},Domain,OnMatch) ->
+filter_domain(equal,#{domain:=Domain},Domain,OnMatch) ->
OnMatch;
-filter_domain(differs,#{domain:=Domain},MatchDomain,OnMatch)
+filter_domain(not_equal,#{domain:=Domain},MatchDomain,OnMatch)
when Domain=/=MatchDomain ->
OnMatch;
-filter_domain(Action,Meta,_,OnMatch) ->
+filter_domain(Compare,Meta,_,OnMatch) ->
case maps:is_key(domain,Meta) of
- false when Action==no_domain; Action==differs -> OnMatch;
+ false when Compare==undefined; Compare==not_equal -> OnMatch;
_ -> ignore
end.
diff --git a/lib/kernel/src/logger_internal.hrl b/lib/kernel/src/logger_internal.hrl
index 97ef4abfa4..fedd6db370 100644
--- a/lib/kernel/src/logger_internal.hrl
+++ b/lib/kernel/src/logger_internal.hrl
@@ -27,8 +27,8 @@
?DEFAULT_HANDLER_FILTERS([beam,erlang,otp])).
-define(DEFAULT_HANDLER_FILTERS(Domain),
[{remote_gl,{fun logger_filters:remote_gl/2,stop}},
- {domain,{fun logger_filters:domain/2,{log,prefix_of,Domain}}},
- {no_domain,{fun logger_filters:domain/2,{log,no_domain,[]}}}]).
+ {domain,{fun logger_filters:domain/2,{log,super,Domain}}},
+ {no_domain,{fun logger_filters:domain/2,{log,undefined,[]}}}]).
-define(DEFAULT_FORMATTER,logger_formatter).
-define(DEFAULT_FORMAT_CONFIG,#{legacy_header=>true,
single_line=>false}).
diff --git a/lib/kernel/test/logger_env_var_SUITE.erl b/lib/kernel/test/logger_env_var_SUITE.erl
index 32612d616e..081d4f0a80 100644
--- a/lib/kernel/test/logger_env_var_SUITE.erl
+++ b/lib/kernel/test/logger_env_var_SUITE.erl
@@ -82,7 +82,7 @@ default(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,StdFilters),
true = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -95,7 +95,7 @@ default_sasl_compatible(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp]}}} =
lists:keyfind(domain,1,StdFilters),
false = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -107,7 +107,7 @@ error_logger_tty(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,StdFilters),
true = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -121,7 +121,7 @@ error_logger_tty_sasl_compatible(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp]}}} =
lists:keyfind(domain,1,StdFilters),
false = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -138,7 +138,7 @@ error_logger_false(Config) ->
info = maps:get(level,SimpleC),
notice = maps:get(level,L),
SimpleFilters = maps:get(filters,SimpleC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,SimpleFilters),
true = lists:keymember(stop_progress,1,SimpleFilters),
false = lists:keymember(sasl_h,1,Hs),
@@ -155,7 +155,7 @@ error_logger_false_progress(Config) ->
info = maps:get(level,SimpleC),
notice = maps:get(level,L),
SimpleFilters = maps:get(filters,SimpleC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,SimpleFilters),
false = lists:keymember(stop_progress,1,SimpleFilters),
false = lists:keymember(sasl_h,1,Hs),
@@ -172,7 +172,7 @@ error_logger_false_sasl_compatible(Config) ->
info = maps:get(level,SimpleC),
notice = maps:get(level,L),
SimpleFilters = maps:get(filters,SimpleC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp]}}} =
lists:keyfind(domain,1,SimpleFilters),
false = lists:keymember(stop_progress,1,SimpleFilters),
true = lists:keymember(sasl_h,1,Hs),
@@ -220,7 +220,7 @@ logger_file(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,StdFilters),
true = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -243,7 +243,7 @@ logger_file_sasl_compatible(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp]}}} =
lists:keyfind(domain,1,StdFilters),
false = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -266,7 +266,7 @@ logger_file_log_progress(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,StdFilters),
false = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -353,7 +353,7 @@ logger_filters(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,StdFilters),
false = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -406,7 +406,7 @@ logger_module_level(Config) ->
{?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,StdFilters),
false = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -428,7 +428,7 @@ logger_disk_log(Config) ->
{?STANDARD_HANDLER,logger_disk_log_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs),
info = maps:get(level,StdC),
StdFilters = maps:get(filters,StdC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,StdFilters),
true = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(logger_simple,1,Hs),
@@ -465,7 +465,7 @@ logger_undefined(Config) ->
info = maps:get(level,SimpleC),
info = maps:get(level,L),
SimpleFilters = maps:get(filters,SimpleC),
- {domain,{_,{log,prefix_of,[beam,erlang,otp,sasl]}}} =
+ {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} =
lists:keyfind(domain,1,SimpleFilters),
true = lists:keymember(stop_progress,1,SimpleFilters),
false = lists:keymember(sasl_h,1,Hs),
diff --git a/lib/kernel/test/logger_filters_SUITE.erl b/lib/kernel/test/logger_filters_SUITE.erl
index c4b31370ff..11cce8fd20 100644
--- a/lib/kernel/test/logger_filters_SUITE.erl
+++ b/lib/kernel/test/logger_filters_SUITE.erl
@@ -75,79 +75,79 @@ all() ->
remote_gl].
domain(_Config) ->
- L1 = logger_filters:domain(L1=?dlog([]),{log,prefix_of,[]}),
- stop = logger_filters:domain(?dlog([]),{stop,prefix_of,[]}),
- L2 = logger_filters:domain(L2=?dlog([]),{log,starts_with,[]}),
- stop = logger_filters:domain(?dlog([]),{stop,starts_with,[]}),
- L3 = logger_filters:domain(L3=?dlog([]),{log,equals,[]}),
- stop = logger_filters:domain(?dlog([]),{stop,equals,[]}),
- ignore = logger_filters:domain(?dlog([]),{log,differs,[]}),
- ignore = logger_filters:domain(?dlog([]),{stop,differs,[]}),
- ignore = logger_filters:domain(?dlog([]),{log,no_domain,[]}),
- ignore = logger_filters:domain(?dlog([]),{stop,no_domain,[]}),
-
- L4 = logger_filters:domain(L4=?dlog([a]),{log,prefix_of,[a,b]}),
- stop = logger_filters:domain(?dlog([a]),{stop,prefix_of,[a,b]}),
- ignore = logger_filters:domain(?dlog([a]),{log,starts_with,[a,b]}),
- ignore = logger_filters:domain(?dlog([a]),{stop,starts_with,[a,b]}),
- ignore = logger_filters:domain(?dlog([a]),{log,equals,[a,b]}),
- ignore = logger_filters:domain(?dlog([a]),{stop,equals,[a,b]}),
- L5 = logger_filters:domain(L5=?dlog([a]),{log,differs,[a,b]}),
- stop = logger_filters:domain(?dlog([a]),{stop,differs,[a,b]}),
- ignore = logger_filters:domain(?dlog([a]),{log,no_domain,[a,b]}),
- ignore = logger_filters:domain(?dlog([a]),{stop,no_domain,[a,b]}),
-
- ignore = logger_filters:domain(?dlog([a,b]),{log,prefix_of,[a]}),
- ignore = logger_filters:domain(?dlog([a,b]),{stop,prefix_of,[a]}),
- L6 = logger_filters:domain(L6=?dlog([a,b]),{log,starts_with,[a]}),
- stop = logger_filters:domain(?dlog([a,b]),{stop,starts_with,[a]}),
- ignore = logger_filters:domain(?dlog([a,b]),{log,equals,[a]}),
- ignore = logger_filters:domain(?dlog([a,b]),{stop,equals,[a]}),
- L7 = logger_filters:domain(L7=?dlog([a,b]),{log,differs,[a]}),
- stop = logger_filters:domain(?dlog([a,b]),{stop,differs,[a]}),
- ignore = logger_filters:domain(?dlog([a,b]),{log,no_domain,[a]}),
- ignore = logger_filters:domain(?dlog([a,b]),{stop,no_domain,[a]}),
-
- ignore = logger_filters:domain(?ndlog,{log,prefix_of,[a]}),
- ignore = logger_filters:domain(?ndlog,{stop,prefix_of,[a]}),
- ignore = logger_filters:domain(?ndlog,{log,starts_with,[a]}),
- ignore = logger_filters:domain(?ndlog,{stop,starts_with,[a]}),
- ignore = logger_filters:domain(?ndlog,{log,equals,[a]}),
- ignore = logger_filters:domain(?ndlog,{stop,equals,[a]}),
- L8 = logger_filters:domain(L8=?ndlog,{log,differs,[a]}),
- stop = logger_filters:domain(?ndlog,{stop,differs,[a]}),
- L9 = logger_filters:domain(L9=?ndlog,{log,no_domain,[a]}),
- stop = logger_filters:domain(?ndlog,{stop,no_domain,[a]}),
-
- L10 = logger_filters:domain(L10=?dlog([a,b,c,d]),{log,prefix_of,[a,b,c,d]}),
- stop = logger_filters:domain(?dlog([a,b,c,d]),{stop,prefix_of,[a,b,c,d]}),
- L11 = logger_filters:domain(L11=?dlog([a,b,c,d]),{log,starts_with,[a,b,c,d]}),
- stop = logger_filters:domain(?dlog([a,b,c,d]),{stop,starts_with,[a,b,c,d]}),
- L12 = logger_filters:domain(L12=?dlog([a,b,c,d]),{log,equals,[a,b,c,d]}),
- stop = logger_filters:domain(?dlog([a,b,c,d]),{stop,equals,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog([a,b,c,d]),{log,differs,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog([a,b,c,d]),{stop,differs,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog([a,b,c,d]),{log,no_domain,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog([a,b,c,d]),{stop,no_domain,[a,b,c,d]}),
+ L1 = logger_filters:domain(L1=?dlog([]),{log,super,[]}),
+ stop = logger_filters:domain(?dlog([]),{stop,super,[]}),
+ L2 = logger_filters:domain(L2=?dlog([]),{log,sub,[]}),
+ stop = logger_filters:domain(?dlog([]),{stop,sub,[]}),
+ L3 = logger_filters:domain(L3=?dlog([]),{log,equal,[]}),
+ stop = logger_filters:domain(?dlog([]),{stop,equal,[]}),
+ ignore = logger_filters:domain(?dlog([]),{log,not_equal,[]}),
+ ignore = logger_filters:domain(?dlog([]),{stop,not_equal,[]}),
+ ignore = logger_filters:domain(?dlog([]),{log,undefined,[]}),
+ ignore = logger_filters:domain(?dlog([]),{stop,undefined,[]}),
+
+ L4 = logger_filters:domain(L4=?dlog([a]),{log,super,[a,b]}),
+ stop = logger_filters:domain(?dlog([a]),{stop,super,[a,b]}),
+ ignore = logger_filters:domain(?dlog([a]),{log,sub,[a,b]}),
+ ignore = logger_filters:domain(?dlog([a]),{stop,sub,[a,b]}),
+ ignore = logger_filters:domain(?dlog([a]),{log,equal,[a,b]}),
+ ignore = logger_filters:domain(?dlog([a]),{stop,equal,[a,b]}),
+ L5 = logger_filters:domain(L5=?dlog([a]),{log,not_equal,[a,b]}),
+ stop = logger_filters:domain(?dlog([a]),{stop,not_equal,[a,b]}),
+ ignore = logger_filters:domain(?dlog([a]),{log,undefined,[a,b]}),
+ ignore = logger_filters:domain(?dlog([a]),{stop,undefined,[a,b]}),
+
+ ignore = logger_filters:domain(?dlog([a,b]),{log,super,[a]}),
+ ignore = logger_filters:domain(?dlog([a,b]),{stop,super,[a]}),
+ L6 = logger_filters:domain(L6=?dlog([a,b]),{log,sub,[a]}),
+ stop = logger_filters:domain(?dlog([a,b]),{stop,sub,[a]}),
+ ignore = logger_filters:domain(?dlog([a,b]),{log,equal,[a]}),
+ ignore = logger_filters:domain(?dlog([a,b]),{stop,equal,[a]}),
+ L7 = logger_filters:domain(L7=?dlog([a,b]),{log,not_equal,[a]}),
+ stop = logger_filters:domain(?dlog([a,b]),{stop,not_equal,[a]}),
+ ignore = logger_filters:domain(?dlog([a,b]),{log,undefined,[a]}),
+ ignore = logger_filters:domain(?dlog([a,b]),{stop,undefined,[a]}),
+
+ ignore = logger_filters:domain(?ndlog,{log,super,[a]}),
+ ignore = logger_filters:domain(?ndlog,{stop,super,[a]}),
+ ignore = logger_filters:domain(?ndlog,{log,sub,[a]}),
+ ignore = logger_filters:domain(?ndlog,{stop,sub,[a]}),
+ ignore = logger_filters:domain(?ndlog,{log,equal,[a]}),
+ ignore = logger_filters:domain(?ndlog,{stop,equal,[a]}),
+ L8 = logger_filters:domain(L8=?ndlog,{log,not_equal,[a]}),
+ stop = logger_filters:domain(?ndlog,{stop,not_equal,[a]}),
+ L9 = logger_filters:domain(L9=?ndlog,{log,undefined,[a]}),
+ stop = logger_filters:domain(?ndlog,{stop,undefined,[a]}),
+
+ L10 = logger_filters:domain(L10=?dlog([a,b,c,d]),{log,super,[a,b,c,d]}),
+ stop = logger_filters:domain(?dlog([a,b,c,d]),{stop,super,[a,b,c,d]}),
+ L11 = logger_filters:domain(L11=?dlog([a,b,c,d]),{log,sub,[a,b,c,d]}),
+ stop = logger_filters:domain(?dlog([a,b,c,d]),{stop,sub,[a,b,c,d]}),
+ L12 = logger_filters:domain(L12=?dlog([a,b,c,d]),{log,equal,[a,b,c,d]}),
+ stop = logger_filters:domain(?dlog([a,b,c,d]),{stop,equal,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog([a,b,c,d]),{log,not_equal,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog([a,b,c,d]),{stop,not_equal,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog([a,b,c,d]),{log,undefined,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog([a,b,c,d]),{stop,undefined,[a,b,c,d]}),
%% A domain field in meta which is not a list is allowed by the
%% filter, but since MatchDomain is always a list of atoms, only
- %% Action=differs can ever match.
- ignore = logger_filters:domain(?dlog(dummy),{log,prefix_of,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog(dummy),{stop,prefix_of,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog(dummy),{log,starts_with,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog(dummy),{stop,starts_with,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog(dummy),{log,equals,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog(dummy),{stop,equals,[a,b,c,d]}),
- L13 = logger_filters:domain(L13=?dlog(dummy),{log,differs,[a,b,c,d]}),
- stop = logger_filters:domain(?dlog(dummy),{stop,differs,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog(dummy),{log,no_domain,[a,b,c,d]}),
- ignore = logger_filters:domain(?dlog(dummy),{stop,no_domain,[a,b,c,d]}),
+ %% Action=not_equal can ever match.
+ ignore = logger_filters:domain(?dlog(dummy),{log,super,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog(dummy),{stop,super,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog(dummy),{log,sub,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog(dummy),{stop,sub,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog(dummy),{log,equal,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog(dummy),{stop,equal,[a,b,c,d]}),
+ L13 = logger_filters:domain(L13=?dlog(dummy),{log,not_equal,[a,b,c,d]}),
+ stop = logger_filters:domain(?dlog(dummy),{stop,not_equal,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog(dummy),{log,undefined,[a,b,c,d]}),
+ ignore = logger_filters:domain(?dlog(dummy),{stop,undefined,[a,b,c,d]}),
{error,badarg} = ?TRY(logger_filters:domain(?ndlog,bad)),
- {error,badarg} = ?TRY(logger_filters:domain(?ndlog,{bad,prefix_of,[]})),
+ {error,badarg} = ?TRY(logger_filters:domain(?ndlog,{bad,super,[]})),
{error,badarg} = ?TRY(logger_filters:domain(?ndlog,{log,bad,[]})),
- {error,badarg} = ?TRY(logger_filters:domain(?ndlog,{log,prefix_of,bad})),
+ {error,badarg} = ?TRY(logger_filters:domain(?ndlog,{log,super,bad})),
ok.
diff --git a/lib/kernel/test/logger_legacy_SUITE.erl b/lib/kernel/test/logger_legacy_SUITE.erl
index b59f5f7758..cfba35e43f 100644
--- a/lib/kernel/test/logger_legacy_SUITE.erl
+++ b/lib/kernel/test/logger_legacy_SUITE.erl
@@ -68,13 +68,13 @@ init_per_group(std, Config) ->
ok = logger:set_handler_config(
error_logger,filters,
[{domain,{fun logger_filters:domain/2,
- {log,prefix_of,[beam,erlang,otp]}}}]),
+ {log,super,[beam,erlang,otp]}}}]),
Config;
init_per_group(sasl, Config) ->
ok = logger:set_handler_config(
error_logger,filters,
[{domain,{fun logger_filters:domain/2,
- {log,prefix_of,[beam,erlang,otp,sasl]}}}]),
+ {log,super,[beam,erlang,otp,sasl]}}}]),
%% cth_log_redirect checks if sasl is started before displaying
%% any sasl reports - so just to see the real sasl reports in tc
diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl
index 9359bdb30e..57e0c6ca82 100644
--- a/lib/sasl/src/sasl.erl
+++ b/lib/sasl/src/sasl.erl
@@ -129,15 +129,8 @@ get_mf_maxf() ->
add_sasl_logger(undefined, _Level) -> ok;
add_sasl_logger(std, undefined) -> ok;
add_sasl_logger(Dest, Level) ->
- FC0 = #{legacy_header=>true,
- single_line=>false,
- template=>[{logger_formatter,header},"\n",msg,"\n"]},
- FC = case application:get_env(sasl,utc_log) of
- {ok,Bool} when is_boolean(Bool) ->
- FC0#{utc=>Bool};
- _ ->
- FC0
- end,
+ FC = #{legacy_header=>true,
+ single_line=>false},
ok = logger:add_handler(sasl_h,logger_std_h,
#{level=>Level,
filter_default=>stop,
@@ -146,7 +139,7 @@ add_sasl_logger(Dest, Level) ->
{fun logger_filters:remote_gl/2,stop}},
{sasl_domain,
{fun logger_filters:domain/2,
- {log,equals,[beam,erlang,otp,sasl]}}}],
+ {log,equal,[beam,erlang,otp,sasl]}}}],
logger_std_h=>#{type=>Dest},
formatter=>{logger_formatter,FC}}).