aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-12-03 11:37:31 +0100
committerSiri Hansen <[email protected]>2018-12-03 11:37:31 +0100
commit3cad3753659ca96e08694c8d5f74bab5a5c7b517 (patch)
tree763750be606087d9cefc317753e6524ce3a36426 /lib/kernel/test
parent721b04340b666d476732dfba31f5c89091085d6e (diff)
parentc64420ee0c50958c61958fcec4947fbbe721a661 (diff)
downloadotp-3cad3753659ca96e08694c8d5f74bab5a5c7b517.tar.gz
otp-3cad3753659ca96e08694c8d5f74bab5a5c7b517.tar.bz2
otp-3cad3753659ca96e08694c8d5f74bab5a5c7b517.zip
Merge branch 'siri/logger/std-recreate-file-if-rotated/OTP-15469' into maint
* siri/logger/std-recreate-file-if-rotated/OTP-15469: [logger] Re-create log file if deleted
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/logger_std_h_SUITE.erl23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/kernel/test/logger_std_h_SUITE.erl b/lib/kernel/test/logger_std_h_SUITE.erl
index a1159f280c..eb17a6d857 100644
--- a/lib/kernel/test/logger_std_h_SUITE.erl
+++ b/lib/kernel/test/logger_std_h_SUITE.erl
@@ -136,7 +136,8 @@ all() ->
mem_kill_new,
mem_kill_std,
restart_after,
- handler_requests_under_load
+ handler_requests_under_load,
+ recreate_deleted_log
].
add_remove_instance_tty(_Config) ->
@@ -1255,6 +1256,22 @@ handler_requests_under_load(Config) ->
handler_requests_under_load(cleanup, _Config) ->
ok = stop_handler(?MODULE).
+recreate_deleted_log(Config) ->
+ {Log,_HConfig,_StdHConfig} =
+ start_handler(?MODULE, ?FUNCTION_NAME, Config),
+ logger:notice("first",?domain),
+ logger_std_h:filesync(?MODULE),
+ ok = file:rename(Log,Log++".old"),
+ logger:notice("second",?domain),
+ logger_std_h:filesync(?MODULE),
+ {ok,<<"first\n">>} = file:read_file(Log++".old"),
+ {ok,<<"second\n">>} = file:read_file(Log),
+ ok.
+recreate_deleted_log(cleanup, _Config) ->
+ ok = stop_handler(?MODULE).
+
+%%%-----------------------------------------------------------------
+%%%
send_requests(HName, TO, Reqs = [{Req,Res}|Rs]) ->
receive
{From,finish} ->
@@ -1276,8 +1293,8 @@ send_requests(HName, TO, Reqs = [{Req,Res}|Rs]) ->
%%%-----------------------------------------------------------------
%%%
-start_handler(Name, TTY, Config) when TTY == standard_io;
- TTY == standard_error->
+start_handler(Name, TTY, _Config) when TTY == standard_io;
+ TTY == standard_error->
ok = logger:add_handler(Name,
logger_std_h,
#{config => #{type => TTY},