Skip to content

Conversation

wankhede04
Copy link
Contributor

Overview

This PR introduces logging enhancements for better logging management. lumberjack library is integrated for log rotation. This ensures that the application's logs are rotated periodically, preventing excessive disk space usage, and facilitating easier log analysis.

Additionally, the PR introduces several new command-line flags that allow for fine-grained control over the logging behavior of the application.

The new flags include:

  • log.dir.path: Directory path to store logs data.
  • log.file.name: Name of the log file.
  • log.file.size.max: Maximum size of a log file in megabytes.
  • log.file.age.max: Maximum age in days a log file can persist in system.
  • log.max.backup: Maximum number of log files that can persist.
  • log.compress: Whether to compress old log files or not.

These flags allow users to control where logs are stored, the maximum size of individual log files, how long log files are retained, how many backup log files are kept, and whether or not to compress old log files.

An example command might look like:

./_bin/diagnostics --tls.cert _demo-tls/diagnostics.crt --tls.key _demo-tls/diagnostics-key.pem --tls.cacerts _demo-tls/CA-cert.pem --log.dir.path /home/user/light-node --log.file.name ddgn.log

Future work

Going forward, we may consider integrating an additional logging library such as logrus to provide more granular control over log levels or verbosity.
Additionally, logrus supports structured logging, which means that logs can be outputted in a machine-readable format (like JSON). This is particularly useful when the logs are to be processed by other software for log analysis and visualization.
We could potentially incorporate these flags (LogConsoleJsonFlag, LogDirJsonFlag, LogVerbosityFlag, LogConsoleVerbosityFlag, LogDirPathFlag, LogDirVerbosityFlag) with logrus, further enhancing the flexibility and control we have over our logging strategy.

@AlexeyAkhunov AlexeyAkhunov merged commit 209e099 into erigontech:main Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants