diff --git a/.gitignore b/.gitignore index 87be3b7a5..6d58f4c0a 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,5 @@ dcos.pem logs/ erl_crash.dump rebar3.crashdump -dump.rdb \ No newline at end of file +dump.rdb +logs \ No newline at end of file diff --git a/Makefile b/Makefile index b89990780..dbd941166 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ shell: plots: pkill -9 beam.smp; \ clear; \ - rm -rf priv/lager/ priv/evaluation; \ + rm -rf logs/lager/ logs/evaluation; \ (cd priv/ && git clone https://github.com/lasp-lang/evaluation); \ ./rebar3 ct --readable=false --suite=test/lasp_peer_to_peer_advertisement_counter_SUITE; \ ./rebar3 ct --readable=false --suite=test/lasp_client_server_advertisement_counter_SUITE; \ @@ -147,10 +147,10 @@ part-div: ./rebar3 ct --readable=false --suite=test/lasp_advertisement_counter_partition_overcounting_SUITE tail-logs: - tail -F priv/lager/*/*/log/*.log + tail -F logs/lager/*/*/log/*.log logs: - cat priv/lager/*/*/log/*.log + cat logs/lager/*/*/log/*.log DIALYZER_APPS = kernel stdlib erts sasl eunit syntax_tools compiler crypto diff --git a/simulations/lasp_gui_resource.erl b/simulations/lasp_gui_resource.erl index 6d608c01b..2c8949e32 100644 --- a/simulations/lasp_gui_resource.erl +++ b/simulations/lasp_gui_resource.erl @@ -60,10 +60,10 @@ content_types_provided(Req, Ctx) -> %% return file path -spec file_path(wrq:reqdata() | list()) -> string(). file_path(Path) when is_list(Path) -> - filename:join([code:priv_dir(?APP)] ++ [Path]); + filename:join([code:lib_dir(?APP)] ++ [Path]); file_path(Req) -> Path=wrq:path_tokens(Req), - filename:join([code:priv_dir(?APP)] ++ Path). + filename:join([code:lib_dir(?APP)] ++ Path). %% loads a resource file from disk and returns it -spec get_file(wrq:reqdata()) -> binary(). diff --git a/simulations/lasp_instrumentation.erl b/simulations/lasp_instrumentation.erl index be5a2de2d..e4ffb5b8c 100644 --- a/simulations/lasp_instrumentation.erl +++ b/simulations/lasp_instrumentation.erl @@ -243,7 +243,7 @@ start_transmission_timer() -> %% @private root_eval_dir() -> - code:priv_dir(?APP) ++ "/evaluation". + code:lib_dir(?APP) ++ "/evaluation". %% @private root_log_dir() -> diff --git a/simulations/lasp_logs_resource.erl b/simulations/lasp_logs_resource.erl index d3a140749..e7d8b330f 100644 --- a/simulations/lasp_logs_resource.erl +++ b/simulations/lasp_logs_resource.erl @@ -37,7 +37,7 @@ content_types_provided(Req, Ctx) -> {[{"application/json", to_json}], Req, Ctx}. to_json(ReqData, State) -> - Filenames = filelib:wildcard("*.csv", code:priv_dir(?APP) ++ "/logs"), + Filenames = filelib:wildcard("*.csv", code:lib_dir(?APP) ++ "/logs"), Filenames1 = [list_to_binary(Filename) || Filename <- Filenames], Encoded = jsx:encode(#{logs => Filenames1}), {Encoded, ReqData, State}. diff --git a/simulations/lasp_plots_resource.erl b/simulations/lasp_plots_resource.erl index badb443f8..5cb905ce3 100644 --- a/simulations/lasp_plots_resource.erl +++ b/simulations/lasp_plots_resource.erl @@ -37,7 +37,7 @@ content_types_provided(Req, Ctx) -> {[{"application/json", to_json}], Req, Ctx}. to_json(ReqData, State) -> - Filenames = filelib:wildcard("*.pdf", code:priv_dir(?APP) ++ "/plots"), + Filenames = filelib:wildcard("*.pdf", code:lib_dir(?APP) ++ "/plots"), Filenames1 = [list_to_binary(Filename) || Filename <- Filenames], Encoded = jsx:encode(#{plots => Filenames1}), {Encoded, ReqData, State}. diff --git a/simulations/lasp_simulation_support.erl b/simulations/lasp_simulation_support.erl index 433f22e58..441dfa8d3 100644 --- a/simulations/lasp_simulation_support.erl +++ b/simulations/lasp_simulation_support.erl @@ -96,8 +96,8 @@ start(Case, _Config, Options) -> LoaderFun = fun(Node) -> ct:pal("Loading lasp on node: ~p", [Node]), - PrivDir = code:priv_dir(?APP), - NodeDir = filename:join([PrivDir, "lager", Case, Node]), + LibDir = code:lib_dir(?APP), + NodeDir = filename:join([LibDir, "logs", "lager", Case, Node]), %% Manually force sasl loading, and disable the logger. ok = rpc:call(Node, application, load, [sasl]), diff --git a/src/lasp_config.erl b/src/lasp_config.erl index 7c97e00a4..d6cb9d35e 100644 --- a/src/lasp_config.erl +++ b/src/lasp_config.erl @@ -55,7 +55,7 @@ web_config() -> Config = [ {ip, Ip}, {port, Port}, - {log_dir, "priv/log"}, + {log_dir, "logs"}, {dispatch, dispatch()} ], Node = lasp_support:mynode(), diff --git a/src/lasp_support.erl b/src/lasp_support.erl index 583ba33d0..38f2ca722 100644 --- a/src/lasp_support.erl +++ b/src/lasp_support.erl @@ -293,8 +293,8 @@ join_to(N, RunnerNode) -> load_lasp(Node, _Config, Case) -> ct:pal("Loading applications on node: ~p", [Node]), - PrivDir = code:priv_dir(?APP), - NodeDir = filename:join([PrivDir, "lager", Case, Node]), + LibDir = code:lib_dir(?APP), + NodeDir = filename:join([LibDir, "logs", "lager", Case, Node]), %% Manually force sasl loading, and disable the logger. ok = rpc:call(Node, application, load, [sasl]), @@ -451,4 +451,4 @@ push_logs() -> %% @doc Return node name. mynode() -> - partisan_peer_service_manager:mynode(). \ No newline at end of file + partisan_peer_service_manager:mynode(). diff --git a/test/lasp_SUITE.erl b/test/lasp_SUITE.erl index 4d1d04566..2226b87cf 100644 --- a/test/lasp_SUITE.erl +++ b/test/lasp_SUITE.erl @@ -391,7 +391,7 @@ sql_run_case(Iterations, Acc, From, To, Row, Threshold0) -> sql_run_case(Iterations - 1, [Time | Acc], From, To, Row, NewThreshold). write_csv(Dir, Option, Cases, Trim) -> - Path = code:priv_dir(lasp) + Path = code:lib_dir(lasp) ++ "/evaluation/logs/" ++ atom_to_list(Dir) ++ "/" ++ atom_to_list(Option) ++ "/"