Replace lager to standard logger

This commit is contained in:
Andrey Fadeev 2019-04-20 03:45:33 +03:00
parent be5ebbd0b8
commit e735f435df
No known key found for this signature in database
GPG Key ID: 7929305440AF7EF5
7 changed files with 56 additions and 66 deletions

View File

@ -2,23 +2,23 @@
cat <<EOF
FROM $BASE_IMAGE
MAINTAINER Sergei Shuvatov <s.shuvatov@rbkmoney.com>
RUN mkdir -p /var/log/bender
COPY ./_build/prod/rel/bender /opt/bender
WORKDIR /opt/bender
CMD /opt/bender/bin/bender foreground
EXPOSE 8022
LABEL base_image_tag=$BASE_IMAGE_TAG
LABEL build_image_tag=$BUILD_IMAGE_TAG
# A bit of magic to get a proper branch name
# even when the HEAD is detached (Hey Jenkins!
# BRANCH_NAME is available in Jenkins env).
LABEL branch=$( \
if [ "HEAD" != $(git rev-parse --abbrev-ref HEAD) ]; then \
echo $(git rev-parse --abbrev-ref HEAD); \
elif [ -n "$BRANCH_NAME" ]; then \
echo $BRANCH_NAME; \
else \
echo $(git name-rev --name-only HEAD); \
fi)
LABEL commit=$(git rev-parse HEAD)
LABEL commit_number=$(git rev-list --count HEAD)
WORKDIR /opt/bender
LABEL com.rbkmoney.$SERVICE_NAME.parent=$BASE_IMAGE_NAME \
com.rbkmoney.$SERVICE_NAME.parent_tag=$BASE_IMAGE_TAG \
com.rbkmoney.$SERVICE_NAME.build_img=build \
com.rbkmoney.$SERVICE_NAME.build_img_tag=$BUILD_IMAGE_TAG \
com.rbkmoney.$SERVICE_NAME.commit_id=$(git rev-parse HEAD) \
com.rbkmoney.$SERVICE_NAME.commit_number=$(git rev-list --count HEAD) \
com.rbkmoney.$SERVICE_NAME.branch=$( \
if [ "HEAD" != $(git rev-parse --abbrev-ref HEAD) ]; then \
echo $(git rev-parse --abbrev-ref HEAD); \
elif [ -n "$BRANCH_NAME" ]; then \
echo $BRANCH_NAME; \
else \
echo $(git name-rev --name-only HEAD); \
fi)
EOF

View File

@ -1,3 +0,0 @@
{erl_opts, [
{parse_transform, lager_transform}
]}.

View File

@ -5,7 +5,6 @@
{applications, [
kernel,
stdlib,
lager,
woody,
scoper,
bender_proto,

View File

@ -65,16 +65,8 @@ groups() ->
config().
init_per_suite(C) ->
Apps = genlib_app:start_application_with(lager, [
{async_threshold, 1},
{async_threshold_window, 0},
{error_logger_hwm, 600},
{suppress_application_start_stop, true},
{handlers, [
{lager_common_test_backend, [error, {lager_logstash_formatter, []}]}
]}
]) ++ genlib_app:start_application_with(scoper, [
{storage, scoper_storage_lager}
Apps = genlib_app:start_application_with(scoper, [
{storage, scoper_storage_logger}
]) ++ genlib_app:start_application_with(bender, [
{generator, #{
path => <<"/v1/stateproc/bender_generator">>,

View File

@ -48,20 +48,29 @@
]}
]},
{lager, [
{error_logger_redirect, true},
{log_root, "/var/log/bender"},
{handlers, [
{lager_console_backend, debug},
{lager_file_backend, [
{file, "log.json"},
{level, debug},
{formatter, lager_logstash_formatter}
]}
{kernel, [
{logger_sasl_compatible, false},
{logger_level, debug},
{logger, [
{handler, default, logger_std_h, #{
level => error,
config => #{
type => standard_error
},
formatter => {logger_formatter, #{
depth => 30
}}
}},
{handler, console, logger_std_h, #{
config => #{
type => {file, "/var/log/bender/log.json"}
},
formatter => {logger_logstash_formatter, #{}}
}}
]}
]},
{scoper, [
{storage, scoper_storage_lager}
{storage, scoper_storage_logger}
]}
].

View File

@ -38,11 +38,8 @@
{git, "https://github.com/rbkmoney/genlib.git",
{branch, "master"}}
},
{lager,
"3.6.4"
},
{lager_logstash_formatter,
{git, "git@github.com:rbkmoney/lager_logstash_formatter.git",
{logger_logstash_formatter,
{git, "git@github.com:rbkmoney/logger_logstash_formatter.git",
{branch, master}}
},
{machinery,
@ -85,7 +82,7 @@
%% Relx configuration
{relx, [
{release, {bender, "1.0.0"}, [
{lager_logstash_formatter, load}, % log formatter
{logger_logstash_formatter, load}, % log formatter
bender
]},
{sys_config, "./config/sys.config"},
@ -123,10 +120,10 @@
]},
{relx, [
{release, {bender, "1.0.0"}, [
{recon, load}, % tools for introspection
{runtime_tools, load}, % debugger
{tools, load}, % profiler
{lager_logstash_formatter, load}, % log formatter
{recon, load}, % tools for introspection
{runtime_tools, load}, % debugger
{tools, load}, % profiler
{logger_logstash_formatter, load}, % log formatter
sasl,
bender
]},

View File

@ -4,7 +4,7 @@
{ref,"70f25cc97512522d37a40ee6b9aedb039150fca0"}},
0},
{<<"cache">>,{pkg,<<"cache">>,<<"2.2.0">>},1},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.4.2">>},2},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.1">>},2},
{<<"cg_mon">>,
{git,"https://github.com/rbkmoney/cg_mon.git",
{ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}},
@ -19,15 +19,13 @@
{git,"https://github.com/rbkmoney/genlib.git",
{ref,"f805a11f6e73faffb05656c5192fbe199df36f27"}},
0},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},1},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.15.0">>},1},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.15.1">>},1},
{<<"idna">>,{pkg,<<"idna">>,<<"6.0.0">>},2},
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.8.0">>},1},
{<<"lager">>,{pkg,<<"lager">>,<<"3.6.4">>},0},
{<<"lager_logstash_formatter">>,
{git,"git@github.com:rbkmoney/lager_logstash_formatter.git",
{ref,"24527c15c47749866f2d427b333fa1333a46b8af"}},
{<<"logger_logstash_formatter">>,
{git,"git@github.com:rbkmoney/logger_logstash_formatter.git",
{ref,"b148e80de2573b0bf91bb4563ad331498e1c6ef4"}},
0},
{<<"machinery">>,
{git,"git@github.com:rbkmoney/machinery.git",
@ -38,7 +36,7 @@
{git,"git@github.com:rbkmoney/machinegun_proto.git",
{ref,"5c07c579014f9900357f7a72f9d10a03008b9da1"}},
1},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.0.2">>},2},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2},
{<<"msgpack_proto">>,
{git,"git@github.com:rbkmoney/msgpack-proto.git",
{ref,"946343842ee740a19701df087edd1f1641eff769"}},
@ -48,7 +46,7 @@
{<<"rfc3339">>,{pkg,<<"rfc3339">>,<<"0.2.2">>},1},
{<<"scoper">>,
{git,"git@github.com:rbkmoney/scoper.git",
{ref,"206f76e006207f75828c1df3dde0deaa8554f332"}},
{ref,"e03318fd1feea0e2bb0ba5c634bb38b18aa81efa"}},
0},
{<<"snowflake">>,
{git,"https://github.com/rbkmoney/snowflake.git",
@ -62,22 +60,20 @@
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.4.1">>},3},
{<<"woody">>,
{git,"git@github.com:rbkmoney/woody_erlang.git",
{ref,"862358ee62a95bf46926be1815f70a72a8679d28"}},
{ref,"90eca450891fa8633ee581dae2aafecde2cf6d9f"}},
0}]}.
[
{pkg_hash,[
{<<"cache">>, <<"3C11DBF4CD8FCD5787C95A5FB2A04038E3729CFCA0386016EEA8C953AB48A5AB">>},
{<<"certifi">>, <<"75424FF0F3BAACCFD34B1214184B6EF616D89E420B258BB0A5EA7D7BC628F7F0">>},
{<<"certifi">>, <<"867CE347F7C7D78563450A18A6A28A8090331E77FA02380B4A21962A65D36EE5">>},
{<<"cowboy">>, <<"4EF3AE066EE10FE01EA3272EDC8F024347A0D3EB95F6FBB9AED556DACBFC1337">>},
{<<"cowlib">>, <<"8AA629F81A0FC189F261DC98A42243FA842625FEEA3C7EC56C48F4CCDB55490F">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>},
{<<"hackney">>, <<"287A5D2304D516F63E56C469511C42B016423BCB167E61B611F6BAD47E3CA60E">>},
{<<"hackney">>, <<"9F8F471C844B8CE395F7B6D8398139E26DDCA9EBC171A8B91342EE15A19963F4">>},
{<<"idna">>, <<"689C46CBCDF3524C44D5F3DDE8001F364CD7608A99556D8FBD8239A5798D4C10">>},
{<<"jsx">>, <<"749BEC6D205C694AE1786D62CEA6CC45A390437E24835FD16D12D74F07097727">>},
{<<"lager">>, <<"CED6E98070FB4E58EE93174D006D46479C79844DF7FC17FA4FEFC1049A320D88">>},
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
{<<"mimerl">>, <<"993F9B0E084083405ED8252B99460C4F0563E41729AB42D9074FD5E52439BE88">>},
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
{<<"ranch">>, <<"6DB93C78F411EE033DBB18BA8234C5574883ACB9A75AF0FB90A9B82EA46AFA00">>},
{<<"rfc3339">>, <<"1552DF616ACA368D982E9F085A0E933B6688A3F4938A671798978EC2C0C58730">>},