From e03c2bd640e1fc1503e92dfd74991f4205973c61 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 5 Mar 2019 11:25:00 +0100 Subject: [logger] Add better control of file modes in logger_std_h OTP-15602 It is allowed to set file modes for the handler to use when opening its log file. The given modes were earlier accepted without any checks, which could make the handler behave unexpectedly. This commit makes sure that * if none of write, append or exclusive is given, then append is added * if raw is not given, it is added * if delayed_write or {delayed_write,_,_} is not given, then delayed_write is added --- lib/kernel/doc/src/logger_std_h.xml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/logger_std_h.xml b/lib/kernel/doc/src/logger_std_h.xml index fcd180abd6..8c5a476d86 100644 --- a/lib/kernel/doc/src/logger_std_h.xml +++ b/lib/kernel/doc/src/logger_std_h.xml @@ -59,14 +59,21 @@

This has the value standard_io, standard_error, {file,LogFileName}, or {file,LogFileName,LogFileOpts}.

-

If LogFileOpts is specified, it replaces the default - list of options used when opening the log file. The default - list is [raw,append,delayed_write]. One reason to do - so can be to change append to, for - example, write, ensuring that the old log is - truncated when a node is restarted. See the reference manual - for file:open/2 - for more information about file options.

+

LogFileOpts specify the file options used when + opening the log file, + see file:open/2. + If LogFileOpts is not specified, the default option + list used is [raw,append,delayed_write]. If LogFileOpts + is specified, it replaces the default options list with the + following adjustments:

+ + + If raw is not found in the list, it is added + + + It write, append or exclusice are not + found in the list, append is added +

Log files are always UTF-8 encoded. The encoding can not be changed by setting the option {encoding,Encoding} in LogFileOpts.

-- cgit v1.2.3