aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-05-24 15:56:07 +0200
committerSiri Hansen <[email protected]>2018-05-24 15:56:07 +0200
commit4f91c8a34f4cc2c728a63e8d218566b3b3795b10 (patch)
tree689a206967ccdbf98e2ecf3d67ffa9ab2fcf0a35 /lib/sasl
parent5c1d8ed81e66ef4977b7b68f573862bcbb9da7ca (diff)
parent53539ee751da408029c9dfae80384fdec6c7a552 (diff)
downloadotp-4f91c8a34f4cc2c728a63e8d218566b3b3795b10.tar.gz
otp-4f91c8a34f4cc2c728a63e8d218566b3b3795b10.tar.bz2
otp-4f91c8a34f4cc2c728a63e8d218566b3b3795b10.zip
Merge branch 'siri/logger-fix'
* siri/logger-fix: Update documentation of logger and error_logger Change type name logger:log() to logger:log_event() Update preloaded Update primary bootstrap Rename module logger_simple to logger_simple_h Change env var logger_log_progress to logger_progress_reports Remove HandlerId from handler callback functions and add it to Config Change handler id for sasl handler from sasl_h to sasl Change Compare parameter to logger_filters:domain/2 Update Logger documentation Rename reset_module_level to unset_module_level Allow chars_limit to limit strings Add logger:update_formatter_config/2,3 Set legacy_header=true for kernel's default handler only Improve documentation of logger and error_logger Use system_time instead of monotonic_time as timestamp in logger
Diffstat (limited to 'lib/sasl')
-rw-r--r--lib/sasl/doc/src/error_logging.xml52
-rw-r--r--lib/sasl/doc/src/sasl_app.xml19
-rw-r--r--lib/sasl/src/sasl.erl17
-rw-r--r--lib/sasl/src/systools_make.erl2
4 files changed, 60 insertions, 30 deletions
diff --git a/lib/sasl/doc/src/error_logging.xml b/lib/sasl/doc/src/error_logging.xml
index 4b2c960bbb..8731b73599 100644
--- a/lib/sasl/doc/src/error_logging.xml
+++ b/lib/sasl/doc/src/error_logging.xml
@@ -32,22 +32,51 @@
<rev>B</rev>
<file>error_logging.xml</file>
</header>
+ <note>
+ <p>The SASL error logging concept desribed in this section is
+ deprecated since OTP-21, 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
+ longer affects which log events that are logged.
+ <seealso marker="#supervisor_report">Supervisor
+ reports</seealso> and <seealso marker="#crash_report">crash
+ reports</seealso> are logged via the default logger handler
+ 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>
+ <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">
+ <c>logger_sasl_compatible</c></seealso> to <c>true</c>.</p>
+ <p>The mechanism
+ for <seealso marker="#multi_file_logging">multi-file error report
+ logging</seealso> as described in this section is also kept for
+ backwards compatibility. However, the new logging API also
+ introduces <seealso marker="kernel:logger_disk_log_h">
+ <c>logger_disk_log_h(3)</c></seealso>, which is a logger
+ handler that can print to multiple files
+ using <seealso marker="kernel:disk_log"><c>disk_log(3)</c></seealso>.</p>
+ </note>
+
+ <section>
+ <title>SASL reports</title>
<p>The SASL application introduces three types of reports:</p>
<list type="bulleted">
<item>Supervisor report</item>
<item>Progress report</item>
<item>Crash report</item>
</list>
- <p>When the SASL application is started, it adds a handler that
- formats and writes these reports, as specified in the configuration
- parameters for SASL, that is, the environment variables
- in the SASL application specification, which is found in the
- <c>.app</c> file of SASL. For details, see the
- <seealso marker="sasl_app"><c>sasl(6)</c></seealso> application in the
- Reference Manual and the <seealso marker="kernel:app"><c>app(4)</c></seealso>
- file in the Kernel Reference Manual.</p>
+ <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>
<section>
+ <marker id="supervisor_report"/>
<title>Supervisor Report</title>
<p>A supervisor report is issued when a supervised child terminates
unexpectedly. A supervisor report contains the following
@@ -68,6 +97,7 @@
</section>
<section>
+ <marker id="progress_report"/>
<title>Progress Report</title>
<p>A progress report is issued when a supervisor starts or
restarts a child. A progress report contains the following items:</p>
@@ -82,6 +112,7 @@
</section>
<section>
+ <marker id="crash_report"/>
<title>Crash Report</title>
<p>Processes started with functions
<seealso marker="stdlib:proc_lib#spawn/1"><c>proc_lib:spawn</c></seealso> or
@@ -105,6 +136,7 @@
crash. The information gathered is the same as the information
for Crasher, described in the previous item.</p></item>
</taglist>
+ </section>
<section>
<title>Example</title>
@@ -163,6 +195,7 @@
</section>
<section>
+ <marker id="multi_file_logging"/>
<title>Multi-File Error Report Logging</title>
<p>Multi-file error report logging is used to store error messages
received by <c>error_logger</c>. The error messages
@@ -171,7 +204,8 @@
of files exist at the same time. The logging is very fast, as
each error message is written as a binary term.</p>
<p>For more details, see the
- <seealso marker="sasl_app"><c>sasl(6)</c></seealso>
+ <seealso marker="sasl_app#deprecated_error_logger_config">
+ <c>sasl(6)</c></seealso>
application in the Reference Manual.</p>
</section>
diff --git a/lib/sasl/doc/src/sasl_app.xml b/lib/sasl/doc/src/sasl_app.xml
index 26b9bece2a..be275879ee 100644
--- a/lib/sasl/doc/src/sasl_app.xml
+++ b/lib/sasl/doc/src/sasl_app.xml
@@ -90,20 +90,22 @@
</section>
<section>
+ <marker id="deprecated_error_logger_config"/>
<title>Deprecated Error Logger Event Handlers and Configuration</title>
- <p>In OTP-21, a new API for logging was added to Erlang/OTP. The
+ <p>In Erlang/OTP 21.0, a new API for logging was added. The
old <c>error_logger</c> event manager, and event handlers
- running on this manager, will still work, but they are not used
+ running on this manager, still work, but they are not used
by default.</p>
<p>The error logger event handlers <c>sasl_report_tty_h</c>
- and <c>sasl_report_file_h</c>, were earliger used for printing
+ and <c>sasl_report_file_h</c>, were earlier used for printing
the so called SASL reports, i.e. <em>supervisor
reports</em>, <em>crash reports</em>, and <em>progress
- reports</em>. These reports are now also printed by the standard
+ 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 easily be
+ reports are by default stopped by a filter, but can be
added by setting the Kernel configuration
- parameter <seealso marker="kernel:kernel_app#logger_log_progress"><c>logger_log_progress=true</c></seealso>.</p>
+ parameter <seealso marker="kernel:kernel_app#logger_progress_reports">
+ <c>logger_progress_reports</c></seealso> to <c>log</c>.</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,10 +133,10 @@
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_h</c>, which will only print the SASL reports. No
+ 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_h</c> handler will be configured according to the
+ <p>The <c>sasl</c> handler will be configured according to the
values of the following SASL application environment
variables.</p>
<taglist>
@@ -218,6 +220,7 @@
<title>See Also</title>
<p><seealso marker="alarm_handler"><c>alarm_handler(3)</c></seealso>,
<seealso marker="kernel:error_logger"><c>error_logger(3)</c></seealso>,
+ <seealso marker="kernel:logger"><c>logger(3)</c></seealso>,
<seealso marker="stdlib:log_mf_h"><c>log_mf_h(3)</c></seealso>,
<seealso marker="rb"><c>rb(3)</c></seealso>,
<seealso marker="release_handler"><c>release_handler(3)</c></seealso>,
diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl
index 9359bdb30e..92b80694d7 100644
--- a/lib/sasl/src/sasl.erl
+++ b/lib/sasl/src/sasl.erl
@@ -129,16 +129,9 @@ 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,
- ok = logger:add_handler(sasl_h,logger_std_h,
+ FC = #{legacy_header=>true,
+ single_line=>false},
+ ok = logger:add_handler(sasl,logger_std_h,
#{level=>Level,
filter_default=>stop,
filters=>
@@ -146,14 +139,14 @@ 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}}).
delete_sasl_logger(undefined) -> ok;
delete_sasl_logger(std) -> ok;
delete_sasl_logger(_Type) ->
- _ = logger:remove_handler(sasl_h),
+ _ = logger:remove_handler(sasl),
ok.
add_error_logger_mf(undefined) -> ok;
diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl
index f4b1b54fd1..6916107623 100644
--- a/lib/sasl/src/systools_make.erl
+++ b/lib/sasl/src/systools_make.erl
@@ -1551,7 +1551,7 @@ mandatory_modules() ->
logger_server,
logger_backend,
logger_config,
- logger_simple,
+ logger_simple_h,
lists,
proc_lib,
supervisor