Skip to content

Commit

Permalink
Truncate log file once it reaches 10MB, keep max 5 archive files (#1317)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoaloi authored May 26, 2022
1 parent f49cb29 commit d5f6dce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/els_lsp/src/erlang_ls.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
-include_lib("els_lsp/include/els_lsp.hrl").

-define(DEFAULT_LOGGING_LEVEL, "info").
-define(LOG_MAX_NO_BYTES, 10 * 1000 * 1000).
-define(LOG_MAX_NO_FILES, 5).

-spec main([any()]) -> ok.
main(Args) ->
Expand Down Expand Up @@ -98,7 +100,9 @@ configure_logging() ->
ok = filelib:ensure_dir(LogFile),
[logger:remove_handler(H) || H <- logger:get_handler_ids()],
Handler = #{
config => #{file => LogFile},
config => #{
file => LogFile, max_no_bytes => ?LOG_MAX_NO_BYTES, max_no_files => ?LOG_MAX_NO_FILES
},
level => LoggingLevel,
formatter => {logger_formatter, #{template => ?LSP_LOG_FORMAT}}
},
Expand Down

0 comments on commit d5f6dce

Please sign in to comment.