aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-11-29 13:53:43 +0100
committerSiri Hansen <[email protected]>2018-11-29 14:17:58 +0100
commit38c038b16835726c1273c57ed806d304498b3aa7 (patch)
tree0f830aa052ff588402cc499cc5c33be3b40d9f45 /lib
parent892409dd4a517f2a6d75db13384c468519df899f (diff)
downloadotp-38c038b16835726c1273c57ed806d304498b3aa7.tar.gz
otp-38c038b16835726c1273c57ed806d304498b3aa7.tar.bz2
otp-38c038b16835726c1273c57ed806d304498b3aa7.zip
[logger] Unlink simple handler before terminating
This avoids an unexpected EXIT message with reason normal beeing printed from logger_server when the simple handler is replaced. It will still be printed if it exists unexpectedly.
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/src/logger_simple_h.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/kernel/src/logger_simple_h.erl b/lib/kernel/src/logger_simple_h.erl
index 8b51dd8569..fe181722f3 100644
--- a/lib/kernel/src/logger_simple_h.erl
+++ b/lib/kernel/src/logger_simple_h.erl
@@ -50,7 +50,6 @@ removing_handler(#{id:=simple}) ->
ok;
Pid ->
Ref = erlang:monitor(process,Pid),
- unlink(Pid),
Pid ! stop,
receive {'DOWN',Ref,process,Pid,_} ->
ok
@@ -99,7 +98,11 @@ loop(Buffer) ->
replay_buffer(Buffer);
_ ->
ok
- end;
+ end,
+ %% Before stopping, we unlink the logger process to avoid
+ %% an unexpected EXIT message
+ unlink(whereis(logger)),
+ ok;
{log,#{msg:=_,meta:=#{time:=_}}=Log} ->
do_log(Log),
loop(update_buffer(Buffer,Log));