From ba4b23c2d1cd07d754518201a5686f09cb1332d2 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 8 Jun 2018 14:21:47 +0200 Subject: [logger] Change base OTP domain from [beam,erlang,otp] to [otp] --- lib/sasl/src/sasl.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sasl') diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl index 92b80694d7..6fb78c0139 100644 --- a/lib/sasl/src/sasl.erl +++ b/lib/sasl/src/sasl.erl @@ -139,7 +139,7 @@ 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]}}}], + {log,equal,[otp,sasl]}}}], logger_std_h=>#{type=>Dest}, formatter=>{logger_formatter,FC}}). -- cgit v1.2.3 From 2ab3e91a44032cab2b173efc33b5d9589eec4864 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 5 Jun 2018 20:50:01 +0200 Subject: [logger] Add more functions for reading configuration Added: * logger:get_config() - replaces i(), returns all Logger configuration, i.e. primary and handler config, and module levels * logger:get_handler_ids() -> [HandlerId] * logger:get_handler_config() -> [{HandlerId,Module,Config}] Removed: * logger:i/1, will probably be replaced in a later release. --- lib/sasl/test/sasl_report_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sasl') 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(), -- cgit v1.2.3 From 7f6e61ca0d752c780ffadd7aacf29aaab0783c78 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 6 Jun 2018 15:58:12 +0200 Subject: [logger] Change name of handler specific config field from ?MODULE to 'config' And add field 'module' in handler config. --- lib/sasl/src/sasl.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sasl') diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl index 6fb78c0139..ab041dbab8 100644 --- a/lib/sasl/src/sasl.erl +++ b/lib/sasl/src/sasl.erl @@ -140,7 +140,7 @@ add_sasl_logger(Dest, Level) -> {sasl_domain, {fun logger_filters:domain/2, {log,equal,[otp,sasl]}}}], - logger_std_h=>#{type=>Dest}, + config=>#{type=>Dest}, formatter=>{logger_formatter,FC}}). delete_sasl_logger(undefined) -> ok; -- cgit v1.2.3 From c026109009942d7a877242f161860cc824223cf1 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 7 Jun 2018 16:23:19 +0200 Subject: [logger] Change default primary log level to 'notice' Log events issued via error_logger:info_msg or error_logger:info_report are now forwarded to Logger with level 'notice' instead of 'info'. Log events issued by gen_* behaviours are also changed from level 'info' to level 'notice'. Progress reports are still 'info', and can therefore easily be included/excluded by changing the primary log level. By default, they are not logged. --- lib/sasl/src/sasl.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/sasl') diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl index ab041dbab8..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, @@ -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 %%%----------------------------------------------------------------- -- cgit v1.2.3 From b9d2cb688e562d200663bdbedfa65adc5a29aeae Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 8 Jun 2018 14:18:36 +0200 Subject: [logger] Update documentation --- lib/sasl/doc/src/error_logging.xml | 15 ++++++++------- lib/sasl/doc/src/sasl_app.xml | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'lib/sasl') 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 @@ error_logging.xml -

The SASL error logging concept desribed in this section is - deprecated since OTP-21, when the +

The SASL error logging concept described in this section is + deprecated since Erlang/OTP 21.0, when the new logging API was introduced.

The new default behaviour is that the SASL application no @@ -45,9 +45,10 @@ which is setup by Kernel. Progress reports are by default not logged, but can be enabled - by setting the Kernel configuration - parameter - logger_progress_reports to log.

+ by setting the primary log level to info, for example by + using the Kernel configuration + parameter + logger_level.

The old SASL error logging behaviour can be re-enabled by setting the Kernel configuration parameter @@ -70,10 +71,10 @@ Progress report Crash report -

When the SASL application is started, it adds a logger handler +

When the SASL application is started, it adds a Logger handler that formats and writes these reports, as specified in the configuration - parameters for SASL

+ parameters for SASL.

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, crash reports, and progress reports. 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 - logger_progress_reports to log.

+ reports are by default stopped by the primary log level, but can + be enabled by setting this level to info, for example by + using the Kernel configuration + parameter + logger_level.

If the old error logger event handlers are still desired, they must be added by calling error_logger:add_report_handler/1,2.

@@ -131,14 +132,13 @@

A similar behaviour, but still using the new logger API, can be obtained by setting the Kernel application environment - variable logger_sasl_compatible=true. This will add a - second instance of the standard logger handler - named sasl, which will only print the SASL reports. No - SASL reports will then be printed by the Kernel logger - handler.

-

The sasl handler will be configured according to the - values of the following SASL application environment - variables.

+ variable + logger_sasl_compatible to true. This + adds a second instance of the standard Logger handler, + named sasl, which only prints the SASL reports. No SASL + reports are then printed by the Kernel logger handler.

+

The sasl handler is configured according to the values + of the following SASL application environment variables.

-- cgit v1.2.3