erlang.log.X generated by run_erl - how to disable?

Hello,

When running the release beside my logging files configured with filters in logger, there is one more file erlang.log.X generated by run_erl (Erlang -- run_erl)

Seems in this file all the logs are written no matter what level info I have in logger default handler .

How can I disable this as it’s pointless and only consume disk space for nothing.

Silviu

1 Like

From what I can see in the documentation, you just have to make sure that your Erlang logs don’t go to stdout.

1 Like

True… but how you do this with logger … the default handle in my case is the one that sends the logs to console and the level is set to critical. No logs are displayed while in this file I see logs with info level…

1 Like

Only solution I found was to delete the default handler (in my case the one that is logging to stdout). Seems for some reason the run_erl is not taking into account the log level set for the handler.

1 Like

run_erl is a poor-man systemd replacement that writes all logs on disk (synchronously!).

Why not to switch to systemd instead?

1 Like

I’m not sure I understand. The application is a standard rebar3 release started via systemd:

[Unit]

Description="APP DESCRIPTION"
After=syslog.target network.target local-fs.target

[Service]

Type=forking
NotifyAccess=main
LimitNOFILE=120000
PIDFile=/app_path/app.pid
LimitCORE=infinity
Restart=on-failure
TimeoutStartSec=300s
RestartSec=5s
WatchdogSec=120

Environment="HOME=/app_path/"
Environment="ERLANG_PID_FILE_PATH=/app_path/app.pid"
Environment="CODE_LOADING_MODE=interactive"


ExecStart=/app_path/bin/app_name start
ExecStop=/app_path/bin/app_name stop

[Install]
WantedBy=multi-user.target

1 Like

The systemd unit file you’ve shown calls app_name start, which uses run_erl to have your release run as an old-school background daemon indeed. With systemd, it’s preferable to call app_name foreground instead, and to set Type=exec rather than Type=forking. This gives systemd better control over the service process(es), including the logging of output written to stdout (and stderr). You can also omit the PIDFile option then.

By the way, recent Rebar3 versions renamed the start argument to daemon (and recommend using foreground instead, if possible), precisely to clarify this difference.

3 Likes

Thanks a lot for your clarifications. I will follow your suggestions !

Silviu

1 Like