diff options
author | Hans Bolinder <[email protected]> | 2017-05-15 14:21:12 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-05-18 15:29:24 +0200 |
commit | a0659634674df165482487495f8d10c3d755c60c (patch) | |
tree | ede73fb9ff9bcc6e8b59a20e9fa09050bc9b27af /lib/stdlib | |
parent | f97921c7ea300ddfce3c37735a6373bd85e55da1 (diff) | |
download | otp-a0659634674df165482487495f8d10c3d755c60c.tar.gz otp-a0659634674df165482487495f8d10c3d755c60c.tar.bz2 otp-a0659634674df165482487495f8d10c3d755c60c.zip |
stdlib: Limit the size of gen_server's error events
The state of the gen_server is limited in error events before exiting
(if the Kernel variable error_logger_format_depth is set).
An alternative is to let the error_logger limit all messages
(error_msg, format, warning_msg, info_msg), which would not limit
reports and also add a smallish overhead to event logging.
It is not decided if the alternative is to be implemented.
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/gen_server.erl | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index ba0a7ae8e5..460ea0ed16 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -107,8 +107,6 @@ %% Internal exports -export([init_it/6]). --import(error_logger, [format/2]). - %%%========================================================================= %%% API %%%========================================================================= @@ -864,11 +862,12 @@ error_info(Reason, Name, From, Msg, State, Debug) -> Reason end, {ClientFmt, ClientArgs} = client_stacktrace(From), - format("** Generic server ~p terminating \n" - "** Last message in was ~p~n" - "** When Server state == ~p~n" - "** Reason for termination == ~n** ~p~n" ++ ClientFmt, - [Name, Msg, State, Reason1] ++ ClientArgs), + LimitedState = error_logger:limit_term(State), + error_logger:format("** Generic server ~p terminating \n" + "** Last message in was ~p~n" + "** When Server state == ~p~n" + "** Reason for termination == ~n** ~p~n" ++ ClientFmt, + [Name, Msg, LimitedState, Reason1] ++ ClientArgs), sys:print_log(Debug), ok. client_stacktrace(undefined) -> |