diff options
author | Siri Hansen <[email protected]> | 2019-02-13 16:02:16 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2019-02-13 16:07:16 +0100 |
commit | 884a0706e351caf2b9c905e7dea4e1528efc0a12 (patch) | |
tree | 81ddef2bfea51c5d305b534e4f8133da70bb0ba6 /lib/kernel/test/logger_std_h_SUITE.erl | |
parent | 664d6d92f7b4d5c6b328f6e3503d372af70d74d6 (diff) | |
download | otp-884a0706e351caf2b9c905e7dea4e1528efc0a12.tar.gz otp-884a0706e351caf2b9c905e7dea4e1528efc0a12.tar.bz2 otp-884a0706e351caf2b9c905e7dea4e1528efc0a12.zip |
[logger] Keep track of inode for logger_std_h log file
If the inode changes, the file is now reopened. This may happen, for
instance, if the log file is opened and saved by an editor.
Diffstat (limited to 'lib/kernel/test/logger_std_h_SUITE.erl')
-rw-r--r-- | lib/kernel/test/logger_std_h_SUITE.erl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/kernel/test/logger_std_h_SUITE.erl b/lib/kernel/test/logger_std_h_SUITE.erl index 484d914ec3..b2c2c8ba67 100644 --- a/lib/kernel/test/logger_std_h_SUITE.erl +++ b/lib/kernel/test/logger_std_h_SUITE.erl @@ -141,7 +141,8 @@ all() -> mem_kill_std, restart_after, handler_requests_under_load, - recreate_deleted_log + recreate_deleted_log, + reopen_changed_log ]. add_remove_instance_tty(_Config) -> @@ -1269,6 +1270,21 @@ recreate_deleted_log(Config) -> recreate_deleted_log(cleanup, _Config) -> ok = stop_handler(?MODULE). +reopen_changed_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"), + ok = file:write_file(Log,""), + 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. +reopen_changed_log(cleanup, _Config) -> + ok = stop_handler(?MODULE). + %%%----------------------------------------------------------------- %%% send_requests(TO, Reqs = [{Mod,Func,Args,Res}|Rs]) -> |