@@ -210,17 +210,26 @@ defmodule Logger do
210210 metadata: [:error_code, :file]
211211
212212 Or to configure default handler, for instance, to log into a file with
213- built-in support for log rotation:
213+ built-in support for log rotation and compression :
214214
215215 config :logger, :default_handler,
216216 config: [
217217 file: ~c"system.log",
218218 filesync_repeat_interval: 5000,
219219 file_check: 5000,
220220 max_no_bytes: 10_000_000,
221- max_no_files: 5
221+ max_no_files: 5,
222+ compress_on_rotate: true
222223 ]
223224
225+ See [`:logger_std_h`](`:logger_std_h`) for all relevant configuration,
226+ including overload protection. Or set `:default_handler` to false to
227+ disable the default logging altogether:
228+
229+ config :logger, :default_handler, false
230+
231+ How to add new handlers is covered in later sections.
232+
224233 > #### Keywords or maps {: .tip}
225234 >
226235 > While Erlang's logger expects `:config` to be a map, Elixir's Logger
@@ -231,14 +240,6 @@ defmodule Logger do
231240 > When reading the handler configuration using Erlang's APIs,
232241 > the configuration will always be read (and written) as a map.
233242
234- See [`:logger_std_h`](`:logger_std_h`) for all relevant configuration,
235- including overload protection. Or set `:default_handler` to false to
236- disable the default logging altogether:
237-
238- config :logger, :default_handler, false
239-
240- How to add new handlers is covered in later sections.
241-
242243 ### Compile configuration
243244
244245 The following configuration must be set via config files (such as
@@ -329,16 +330,19 @@ defmodule Logger do
329330 default handler, but you can use Erlang's [`:logger`](`:logger`) module
330331 to add other handlers too.
331332
332- Erlang/OTP handlers must be listed under your own application. For example,
333- to setup an additional handler that writes to disk:
333+ Erlang/OTP handlers must be listed under your own application.
334+ For example, to setup an additional handler, so you write to
335+ console and file:
334336
335337 config :my_app, :logger, [
336- {:handler, :disk_log , :logger_disk_log_h , %{
338+ {:handler, :file_log , :logger_std_h , %{
337339 config: %{
338- file: ' system.log' ,
340+ file: ~c" system.log" ,
339341 filesync_repeat_interval: 5000,
342+ file_check: 5000,
340343 max_no_bytes: 10_000_000,
341- max_no_files: 5
344+ max_no_files: 5,
345+ compress_on_rotate: true
342346 },
343347 formatter: Logger.Formatter.new()
344348 }}
@@ -355,9 +359,12 @@ defmodule Logger do
355359 flexibility but they should avoid performing any long running action in
356360 such handlers, as it may slow down the action being executed considerably.
357361 At the moment, there is no built-in overload protection for Erlang handlers,
358- so it is your responsibility to implement it. Alternatively, you can use the
359- [`:logger_backends`](https://github.com/elixir-lang/logger_backends)
360- project.
362+ so it is your responsibility to implement it.
363+
364+ Alternatively, you can use the
365+ [`:logger_backends`](https://github.com/elixir-lang/logger_backends) project.
366+ It sets up a log handler with overload protection and allows incoming events
367+ to be dispatched to multiple backends.
361368
362369 ## Backends and backwards compatibility
363370
0 commit comments