/ erlang

Enable sasl reports in OTP 21+

OTP 21 introduced a new logging framework.

OTP-13295    Application(s): erts, kernel, sasl, stdlib

               A new logging API is added to OTP. This is implemented
               in the Kernel application, module logger.

               Legacy calls to error_logger will be automatically
               redirected to the new API.

               See the reference manual for module logger, and the
               User's Guide for the Kernel application for more
               information.

There is no concept of sasl reports (progress/error/crash) in OTP 21. error and crash reports are printed by default but supervisor progress reports are not logged.

We have two option to enable progress/(sasl) reports.

  1. Enable legacy SASL report with a environment variable.
  2. Enable progress report in all new logger.

Run logger with sasl compatibility mode:

This can be done by setting the environment variable for kernel logger_sasl_compatible to true.

erl -kernel logger_sasl_compatible true

Enable progress report with new logger framework:

Set logger_log_progress to true and logger_level to info. Progress reports are logged as info log and the default log level is notice and hence we must set the default log level to info.

erl -kernel logger_log_progress true logger_level info
erl -kernel logger_log_progress true logger_level info
Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]

=PROGRESS REPORT==== 2-Dec-2018::15:10:47.177543 ===
    application: kernel
    started_at: nonode@nohost
=PROGRESS REPORT==== 2-Dec-2018::15:10:47.182904 ===
    application: stdlib
    started_at: nonode@nohost
Eshell V10.1  (abort with ^G)
1> application:start(sasl).
=PROGRESS REPORT==== 2-Dec-2018::15:10:55.564694 ===
    supervisor: {local,sasl_safe_sup}
    started: [{pid,<0.83.0>},
              {id,alarm_handler}, 
              {mfargs,{alarm_handler,start_link,[]}},
              {restart_type,permanent},
              {shutdown,2000},
              {child_type,worker}]
=PROGRESS REPORT==== 2-Dec-2018::15:10:55.564963 ===
    supervisor: {local,sasl_sup}
    started: [{pid,<0.82.0>},
              {id,sasl_safe_sup},
              {mfargs,{supervisor,start_link,
                                  [{local,sasl_safe_sup},sasl,safe]}},
              {restart_type,permanent},
              {shutdown,infinity},
              {child_type,supervisor}]
=PROGRESS REPORT==== 2-Dec-2018::15:10:55.568784 ===
    supervisor: {local,sasl_sup}
    started: [{pid,<0.84.0>},
              {id,release_handler},
              {mfargs,{release_handler,start_link,[]}},
              {restart_type,permanent},
              {shutdown,2000},
              {child_type,worker}]
=PROGRESS REPORT==== 2-Dec-2018::15:10:55.569054 ===
    application: sasl
    started_at: nonode@nohost

References:

OTP User Guide for Kernel application
OTP 21 Highlights blog