# How to make the default logger log everything?

**URL:** <https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461>\
**Category:** Questions / Help\
**Tags:** erlang-logger\
**Created:** [November 4, 2021, 4:18pm UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461 "2021-11-04T16:18:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkoops](https://erlangforums.com/user_avatar/erlangforums.com/jkoops/32/1576_2.png) [@jkoops](https://erlangforums.com/u/jkoops)\
**Post date:** [November 4, 2021, 4:18pm UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461/1 "2021-11-04T16:18:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rvirding](https://erlangforums.com/user_avatar/erlangforums.com/rvirding/32/178_2.png) [@rvirding](https://erlangforums.com/u/rvirding)\
**Post date:** [November 5, 2021, 2:25am UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461/2 "2021-11-05T02:25:00Z")

</div>

A very simple way is to have a config file with

```
[{kernel,
  [{logger_level, all}]
 }
].

```

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

```
1> logger:set_primary_config(level, info).
ok

```

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

---

<div class="post-metadata">

**Author:** ![jkoops](https://erlangforums.com/user_avatar/erlangforums.com/jkoops/32/1576_2.png) [@jkoops](https://erlangforums.com/u/jkoops)\
**Post date:** [November 5, 2021, 7:31am UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461/3 "2021-11-05T07:31:19Z")

</div>

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`:

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

```

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

```erlang
(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.

---

<div class="post-metadata">

**Author:** ![essen](https://erlangforums.com/letter_avatar_proxy/v4/letter/e/bc79bd/32.png) [@essen](https://erlangforums.com/u/essen)\
**Post date:** [November 5, 2021, 2:41pm UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461/4 "2021-11-05T14:41:09Z")

</div>

That’s because the group leader redirects the output to node\_b.

---

<div class="post-metadata">

**Author:** ![rvirding](https://erlangforums.com/user_avatar/erlangforums.com/rvirding/32/178_2.png) [@rvirding](https://erlangforums.com/u/rvirding)\
**Post date:** [November 5, 2021, 4:01pm UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461/5 "2021-11-05T16:01:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jkoops](https://erlangforums.com/user_avatar/erlangforums.com/jkoops/32/1576_2.png) [@jkoops](https://erlangforums.com/u/jkoops)\
**Post date:** [November 9, 2021, 8:29am UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461/6 "2021-11-09T08:29:04Z")

</div>

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](https://www.erlang.org/doc/apps/stdlib/io_protocol.html)) and have all I/O handled by that process.

---

<div class="post-metadata">

**Author:** ![phild](https://erlangforums.com/user_avatar/erlangforums.com/phild/32/742_2.png) [@phild](https://erlangforums.com/u/phild)\
**Post date:** [November 9, 2021, 12:43pm UTC](https://erlangforums.com/t/how-to-make-the-default-logger-log-everything/461/7 "2021-11-09T12:43:13Z")

</div>

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