aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger_disk_log_h.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/src/logger_disk_log_h.erl')
-rw-r--r--lib/kernel/src/logger_disk_log_h.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/kernel/src/logger_disk_log_h.erl b/lib/kernel/src/logger_disk_log_h.erl
index f08621c9c5..cf8ea658e3 100644
--- a/lib/kernel/src/logger_disk_log_h.erl
+++ b/lib/kernel/src/logger_disk_log_h.erl
@@ -249,7 +249,8 @@ init([Name,
max_no_files:=MNF}},
State = #{dl_sync_int := DLSyncInt}]) ->
- register(?name_to_reg_name(?MODULE,Name), self()),
+ RegName = ?name_to_reg_name(?MODULE,Name),
+ register(RegName, self()),
process_flag(trap_exit, true),
process_flag(message_queue_data, off_heap),
@@ -296,10 +297,12 @@ init([Name,
enter_loop(Config1, State1)
catch
_:Error ->
+ unregister(RegName),
logger_h_common:error_notify({open_disk_log,Name,Error}),
proc_lib:init_ack(Error)
end;
Error ->
+ unregister(RegName),
logger_h_common:error_notify({open_disk_log,Name,Error}),
proc_lib:init_ack(Error)
end.
@@ -426,6 +429,7 @@ terminate(Reason, State = #{id := Name}) ->
_ = logger_h_common:cancel_timer(maps:get(rep_sync_tref, State,
undefined)),
_ = close_disk_log(Name, normal),
+ unregister(?name_to_reg_name(?MODULE, Name)),
logger_h_common:stop_or_restart(Name, Reason, State).
code_change(_OldVsn, State, _Extra) ->