lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

"Failed to initialize libp2p rolling file" when `--logfile` is specified

Open jimmygchen opened this issue 6 months ago • 4 comments

Description

A discord user reported getting Failed to initialize libp2p rolling file appender on startup on his beacon nodes for several versions now.

The user uses the --logfile flag, which is not only used as the lighthouse log file path, but also used as a directory path for libp2p logs.

This causes the libp2p RollingFileAppender to fail to build, because the file already exist and directory cannot be created.

The code below assumes that logfile is a directory, and is used as the directory path for libp2p logging:

https://github.com/sigp/lighthouse/blob/6856134ded14d8986c4ddd40abd3b26f87f09924/lighthouse/src/main.rs#L618-L630

This was a regression introduced in #4988 (v4.6.0) and impacts users running beacon node with the --logfile flag.

Version

v5.3.0

Present Behaviour

Error log Failed to initialize libp2p rolling file appender and no libp2p and discv5 created.

The only workaround now is to avoid using --logfile and have the logs stored under the data directory.

Expected Behaviour

No error and libp2p & discv5 logs present in the specified log location. How should the application behave?

Steps to resolve

Please describe the steps required to resolve this issue, if known.

jimmygchen avatar Aug 09 '24 04:08 jimmygchen