Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable log level #37

Open
wants to merge 1 commit into
base: cloudant
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/basho_bench.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ setup_benchmark(Opts, Configs) ->
TestDir = test_dir(Opts, BenchName),
application:set_env(basho_bench, test_dir, TestDir),
basho_bench_config:set(test_id, BenchName),
ConsoleLagerLevel = application:get_env(basho_bench, log_level, debug),
ConsoleLagerLevel = application:get_env(basho_bench, level, debug),

ErrorLog = filename:join([TestDir, "error.log"]),
ConsoleLog = filename:join([TestDir, "console.log"]),
CrashLog = filename:join([TestDir, "crash.log"]),
Expand All @@ -62,10 +63,6 @@ setup_benchmark(Opts, Configs) ->
application:set_env(lager, crash_log, CrashLog),
load_apps([lager, basho_bench]),
lager:start(),
%% Log level can be overriden by the config files
CustomLagerLevel = basho_bench_config:get(log_level, debug),
lager:set_loglevel(lager_console_backend, CustomLagerLevel),
lager:set_loglevel(lager_file_backend, ConsoleLog, CustomLagerLevel),
case basho_bench_config:get(distribute_work, false) of
true -> setup_distributed_work();
false -> ok
Expand All @@ -87,7 +84,10 @@ setup_benchmark(Opts, Configs) ->
%% Make sure this happens after starting lager or failures wont
%% show.
basho_bench_config:load(Configs),

%% Log level can be overriden by the config files
CustomLagerLevel = basho_bench_config:get(level, info),
lager:set_loglevel(lager_console_backend, CustomLagerLevel),
lager:set_loglevel(lager_file_backend, ConsoleLog, CustomLagerLevel),
%% Copy the config into the test dir for posterity
[ begin {ok, _} = file:copy(Config, filename:join(TestDir, filename:basename(Config))) end
|| Config <- Configs ],
Expand Down