aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2011-05-10 11:00:06 +0200
committerSiri Hansen <[email protected]>2011-05-10 11:00:06 +0200
commitc9eddec384e1278719873e0e4859b203504634e8 (patch)
tree9937d060ddb1fd447c6f42e09be7f5769e0ab195 /lib
parent67be6297d72dc10d13bdf6fa8e6892cedf68ee15 (diff)
parent2187b54499a280fdf92e8832a5126cadeb9cd610 (diff)
downloadotp-c9eddec384e1278719873e0e4859b203504634e8.tar.gz
otp-c9eddec384e1278719873e0e4859b203504634e8.tar.bz2
otp-c9eddec384e1278719873e0e4859b203504634e8.zip
Merge branch 'siri/sasl/log_mf_h-env-missing/OTP-9185' into dev
* siri/sasl/log_mf_h-env-missing/OTP-9185: Fail sasl startup if some, but not all, environment variables related to log_mf_h are given
Diffstat (limited to 'lib')
-rw-r--r--lib/sasl/doc/src/sasl_app.xml7
-rw-r--r--lib/sasl/src/sasl.erl21
2 files changed, 22 insertions, 6 deletions
diff --git a/lib/sasl/doc/src/sasl_app.xml b/lib/sasl/doc/src/sasl_app.xml
index a7fecfc440..446baccb08 100644
--- a/lib/sasl/doc/src/sasl_app.xml
+++ b/lib/sasl/doc/src/sasl_app.xml
@@ -4,7 +4,7 @@
<appref>
<header>
<copyright>
- <year>1996</year><year>2009</year>
+ <year>1996</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -67,6 +67,11 @@
<p>This error logger writes <em>all</em> events sent to
the error logger to disk. It installs the <c>log_mf_h</c>
event handler in the <c>error_logger</c> process.</p>
+ <p>To activate this event handler, the following three sasl
+ configuration parameters must be set:
+ <c>error_logger_mf_dir</c>, <c>error_logger_mf_maxbytes</c>
+ and <c>error_logger_mf_maxfiles</c>. See below for more
+ information about the configuration parameters.</p>
</item>
</taglist>
</section>
diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl
index d1babaffff..aed5f0da1f 100644
--- a/lib/sasl/src/sasl.erl
+++ b/lib/sasl/src/sasl.erl
@@ -81,27 +81,38 @@ get_mf() ->
Dir = get_mf_dir(),
MaxB = get_mf_maxb(),
MaxF = get_mf_maxf(),
- {Dir, MaxB, MaxF}.
+ case {Dir, MaxB, MaxF} of
+ {undefined,undefined,undefined} = R ->
+ R;
+ {undefined,_,_} ->
+ exit({missing_config, {sasl, error_logger_mf_dir}});
+ {_,undefined,_} ->
+ exit({missing_config, {sasl, error_logger_mf_maxbytes}});
+ {_,_,undefined} ->
+ exit({missing_config, {sasl, error_logger_mf_maxfiles}});
+ R ->
+ R
+ end.
get_mf_dir() ->
case application:get_env(sasl, error_logger_mf_dir) of
- {ok, false} -> throw(undefined);
+ {ok, false} -> undefined;
{ok, Dir} when is_list(Dir) -> Dir;
- undefined -> throw(undefined);
+ undefined -> undefined;
{ok, Bad} -> exit({bad_config, {sasl, {error_logger_mf_dir, Bad}}})
end.
get_mf_maxb() ->
case application:get_env(sasl, error_logger_mf_maxbytes) of
{ok, MaxB} when is_integer(MaxB) -> MaxB;
- undefined -> throw(undefined);
+ undefined -> undefined;
{ok, Bad} -> exit({bad_config, {sasl, {error_logger_mf_maxbytes, Bad}}})
end.
get_mf_maxf() ->
case application:get_env(sasl, error_logger_mf_maxfiles) of
{ok, MaxF} when is_integer(MaxF), MaxF > 0, MaxF < 256 -> MaxF;
- undefined -> throw(undefined);
+ undefined -> undefined;
{ok, Bad} -> exit({bad_config, {sasl, {error_logger_mf_maxfiles, Bad}}})
end.