How to make the default logger log everything?

The documentation for erlang:logger says:

By default, the Kernel application installs one log handler at system start. This handler is named default. It receives and processes standard log events produced by the Erlang runtime system, standard behaviours and different Erlang/OTP applications. The log events are by default printed to the terminal.

This is no lie - only standard log events produced by the Erlang runtime system, standard behaviours and different Erlang/OTP applications are logged, others are ignored.

What is the easiest way to configure the logger in such a way that it logs everything?


A very simple way is to have a config file with

  [{logger_level, all}]

This can be also be done from inside a running system with

1> logger:set_primary_config(level, info).

Check out the user guide section of the kernel application where there are some sections on the logger.


Hi Robert,

Even with the logger_level set to all (which is documented as a possible value, but without explanation of what it does, by the way), this still does not log when the logger is invoked with an RPC.

For example, I can log messages on node node_a:

(node_a@newspace)3> logger:info("Hello").
=INFO REPORT==== 5-Nov-2021::08:21:03.443058 ===

But when RPC-ing from node_b to node_a, like so:

(node_b@newspace)12> rpc:call(node_a@newspace, logger, info, [ "Hello" ]).

the log-output does not show on node_a.

Only when I do an RPC from node_b to node_a that ends up calling a running gen_server or other OTP behaviour that performs logging, that log output is visible again.


That’s because the group leader redirects the output to node_b.


Yes, the logger has its own group leader as it can be called from many different groups on one node. E.g. when you start multiple shells (try CTRL-g and then s and c) each shell and processes it starts are in their own group.


Interesting – I was vaguely aware of the groupleader concept, but never really looked into it. Now I see that you can simply set the groupleader of a process to any process that implements the io protocol (Erlang -- The Erlang I/O Protocol) and have all I/O handled by that process.


I have learned something new today. I wonder what I have forgotten in order to make space for it…