aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sasl')
-rw-r--r--lib/sasl/doc/src/error_logging.xml15
-rw-r--r--lib/sasl/doc/src/sasl_app.xml24
-rw-r--r--lib/sasl/src/sasl.erl16
-rw-r--r--lib/sasl/test/sasl_report_SUITE.erl2
4 files changed, 35 insertions, 22 deletions
diff --git a/lib/sasl/doc/src/error_logging.xml b/lib/sasl/doc/src/error_logging.xml
index 8731b73599..356b1f98e9 100644
--- a/lib/sasl/doc/src/error_logging.xml
+++ b/lib/sasl/doc/src/error_logging.xml
@@ -33,8 +33,8 @@
<file>error_logging.xml</file>
</header>
<note>
- <p>The SASL error logging concept desribed in this section is
- deprecated since OTP-21, when the
+ <p>The SASL error logging concept described in this section is
+ deprecated since Erlang/OTP 21.0, when the
new <seealso marker="kernel:logger_chapter">logging
API</seealso> was introduced.</p>
<p>The new default behaviour is that the SASL application no
@@ -45,9 +45,10 @@
which is setup by
Kernel. <seealso marker="#progress_report">Progress
reports</seealso> are by default not logged, but can be enabled
- by setting the Kernel configuration
- parameter <seealso marker="kernel:kernel_app#logger_progress_reports">
- <c>logger_progress_reports</c></seealso> to <c>log</c>.</p>
+ by setting the primary log level to <c>info</c>, for example by
+ using the Kernel configuration
+ parameter <seealso marker="kernel:kernel_app#logger_level">
+ <c>logger_level</c></seealso>.</p>
<p>The old SASL error logging behaviour can be re-enabled by setting the
Kernel configuration
parameter <seealso marker="kernel:kernel_app#logger_sasl_compatible">
@@ -70,10 +71,10 @@
<item>Progress report</item>
<item>Crash report</item>
</list>
- <p>When the SASL application is started, it adds a logger handler
+ <p>When the SASL application is started, it adds a Logger handler
that formats and writes these reports, as specified in
the <seealso marker="sasl_app#deprecated_error_logger_config">configuration
- parameters for SASL</seealso></p>
+ parameters for SASL</seealso>.</p>
<section>
<marker id="supervisor_report"/>
diff --git a/lib/sasl/doc/src/sasl_app.xml b/lib/sasl/doc/src/sasl_app.xml
index be275879ee..6f3b4fd7b0 100644
--- a/lib/sasl/doc/src/sasl_app.xml
+++ b/lib/sasl/doc/src/sasl_app.xml
@@ -102,10 +102,11 @@
reports</em>, <em>crash reports</em>, and <em>progress
reports</em>. These reports are now also printed by the default
logger handler started by the Kernel application. Progress
- reports are by default stopped by a filter, but can be
- added by setting the Kernel configuration
- parameter <seealso marker="kernel:kernel_app#logger_progress_reports">
- <c>logger_progress_reports</c></seealso> to <c>log</c>.</p>
+ reports are by default stopped by the primary log level, but can
+ be enabled by setting this level to <c>info</c>, for example by
+ using the Kernel configuration
+ parameter <seealso marker="kernel:kernel_app#logger_level">
+ <c>logger_level</c></seealso>.</p>
<p>If the old error logger event handlers are still desired, they
must be added by
calling <c>error_logger:add_report_handler/1,2</c>.</p>
@@ -131,14 +132,13 @@
</taglist>
<p>A similar behaviour, but still using the new logger API, can be
obtained by setting the Kernel application environment
- variable <seealso marker="kernel:kernel_app#logger_sasl_compatible"><c>logger_sasl_compatible=true</c></seealso>. This will add a
- second instance of the standard logger handler
- named <c>sasl</c>, which will only print the SASL reports. No
- SASL reports will then be printed by the Kernel logger
- handler.</p>
- <p>The <c>sasl</c> handler will be configured according to the
- values of the following SASL application environment
- variables.</p>
+ variable <seealso marker="kernel:kernel_app#logger_sasl_compatible">
+ <c>logger_sasl_compatible</c></seealso> to <c>true</c>. This
+ adds a second instance of the standard Logger handler,
+ named <c>sasl</c>, which only prints the SASL reports. No SASL
+ reports are then printed by the Kernel logger handler.</p>
+ <p>The <c>sasl</c> handler is configured according to the values
+ of the following SASL application environment variables.</p>
<taglist>
<tag><c><![CDATA[sasl_error_logger = Value ]]></c></tag>
<item>
diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl
index 92b80694d7..5db3d75cfb 100644
--- a/lib/sasl/src/sasl.erl
+++ b/lib/sasl/src/sasl.erl
@@ -131,6 +131,10 @@ add_sasl_logger(std, undefined) -> ok;
add_sasl_logger(Dest, Level) ->
FC = #{legacy_header=>true,
single_line=>false},
+ case Level of
+ info -> allow_progress();
+ _ -> ok
+ end,
ok = logger:add_handler(sasl,logger_std_h,
#{level=>Level,
filter_default=>stop,
@@ -139,8 +143,8 @@ add_sasl_logger(Dest, Level) ->
{fun logger_filters:remote_gl/2,stop}},
{sasl_domain,
{fun logger_filters:domain/2,
- {log,equal,[beam,erlang,otp,sasl]}}}],
- logger_std_h=>#{type=>Dest},
+ {log,equal,[otp,sasl]}}}],
+ config=>#{type=>Dest},
formatter=>{logger_formatter,FC}}).
delete_sasl_logger(undefined) -> ok;
@@ -151,6 +155,7 @@ delete_sasl_logger(_Type) ->
add_error_logger_mf(undefined) -> ok;
add_error_logger_mf({Dir, MaxB, MaxF}) ->
+ allow_progress(),
error_logger:add_report_handler(
log_mf_h, log_mf_h:init(Dir, MaxB, MaxF, fun pred/1)).
@@ -161,6 +166,13 @@ delete_error_logger_mf(_) ->
pred({_Type, GL, _Msg}) when node(GL) =/= node() -> false;
pred(_) -> true.
+allow_progress() ->
+ #{level:=PL} = logger:get_primary_config(),
+ case logger:compare_levels(info,PL) of
+ lt -> ok = logger:set_primary_config(level,info);
+ _ -> ok
+ end.
+
%%%-----------------------------------------------------------------
%%% supervisor functionality
%%%-----------------------------------------------------------------
diff --git a/lib/sasl/test/sasl_report_SUITE.erl b/lib/sasl/test/sasl_report_SUITE.erl
index 72ee2f0a10..c3e0fdd63b 100644
--- a/lib/sasl/test/sasl_report_SUITE.erl
+++ b/lib/sasl/test/sasl_report_SUITE.erl
@@ -82,7 +82,7 @@ do_gen_server_crash(Config, Encoding) ->
application:set_env(kernel, error_logger_format_depth, 30),
error_logger:logfile({open,KernelLog}),
application:start(sasl),
- logger:i(print),
+ ct:log("Logger config:~n~p",[logger:get_config()]),
ct:log("error_logger handlers: ~p",[error_logger:which_report_handlers()]),
crash_me(),