Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

output critical error messages in stderr; exit status is now > 0 if a

config error occurs (TSUN-197)
  • Loading branch information...
commit f1033ceff56e0fc120d34c10fc61e04da765c6da 1 parent 30cde94
@nniclausse nniclausse authored
View
9 src/tsung_controller/ts_config.erl
@@ -208,7 +208,7 @@ parse(Element = #xmlElement{name=client, attributes=Attrs},
{unix, linux} ->
{scan, Interface};
OS ->
- ?LOGF("Scan interface is not supported on OS ~p, abort~n",[OS],?ERR),
+ io:format(standard_error,"Scan interface is not supported on OS ~p, abort~n",[OS]),
exit({error, scan_interface_not_supported_on_os})
end
end,
@@ -225,8 +225,7 @@ parse(Element = #xmlElement{name=client, attributes=Attrs},
%% must be hostname and not ip:
case ts_utils:is_ip(Host) of
true ->
- ?LOGF("ERROR: client config: 'host' attribute must be a hostname, "++
- "not an IP ! (was ~p)~n",[Host],?EMERG),
+ io:format(standard_error,"ERROR: client config: 'host' attribute must be a hostname, "++ "not an IP ! (was ~p)~n",[Host]),
exit({error, badhostname});
false ->
%% add a new client for each CPU
@@ -281,7 +280,7 @@ parse(Element = #xmlElement{name=arrivalphase, attributes=Attrs},
|AList]},
Element#xmlElement.content);
_ -> % already existing phase, wrong configuration.
- ?LOGF("Client config error: phase ~p already defined, abort !~n",[Phase],?EMERG),
+ io:format(standard_error,"Client config error: phase ~p already defined, abort !~n",[Phase]),
exit({error, already_defined_phase})
end;
@@ -795,7 +794,7 @@ parse(Element = #xmlElement{name=setdynvars, attributes=Attrs},
Delimiter = getAttr(string,Attrs,delimiter,";"),
{setdynvars,file,{Order,FileId,Delimiter},Vars};
false ->
- ?LOGF("Unknown_file_id ~p in file setdynvars declaration: you forgot to add a file_server option~n",[FileId],?EMERG),
+ io:format(standard_error, "Unknown_file_id ~p in file setdynvars declaration: you forgot to add a file_server option~n",[FileId]),
exit({error, unknown_file_id})
end;
"random_string" ->
View
13 src/tsung_controller/tsung_controller.erl
@@ -49,13 +49,12 @@ start(_Type, _StartArgs) ->
{ok, Pid} ->
{ok, Pid};
Error ->
- ?LOGF("Can't start ! ~p ~n",[Error], ?ERR),
+ io:format(standard_error,"Can't start ! ~p ~n",[Error]),
Error
end;
{error, Reason} ->
Msg = "Error while opening log file: " ,
- ?LOGF(Msg ++ " ~p ~n",[Reason], ?ERR),
- erlang:display(Msg ++ Reason),
+ io:format(standard_error,Msg ++ " ~p ~n",[Reason]),
{error, Reason}
end.
@@ -67,10 +66,10 @@ start_phase(load_config, _StartType, _PhaseArgs) ->
File ->
T = case file:read_file_info(File) of
{ok, #file_info{size=Size}} when Size > 10000000 -> % > 10MB
- erlang:display(["Can take up to 5mn to read config ",Size]),
+ io:format(standard_error,"Can take up to 5mn to read config ~p~n ",[Size]),
300000; % 10mn
{ok, #file_info{size=Size}} when Size > 1000000 -> % > 1MB
- erlang:display(["Can take up to 3mn to read config ",Size]),
+ io:format(standard_error,"Can take up to 3mn to read config ~p~n ",[Size]),
180000; % 5mn
{ok, #file_info{size=_}} ->
120000 % 2mn
@@ -79,8 +78,8 @@ start_phase(load_config, _StartType, _PhaseArgs) ->
end,
case ts_config_server:read_config(Conf,Timeout) of
{error,Reason}->
- erlang:display(["Config Error, aborting ! ", Reason]),
- init:stop();
+ io:format(standard_error,"Config Error, aborting ! ~p~n ",[Reason]),
+ init:stop(1);
ok -> ok
end;
start_phase(start_os_monitoring, _StartType, _PhaseArgs) ->
Please sign in to comment.
Something went wrong with that request. Please try again.