Skip to content

Implement rolling trace log#226

Merged
benbjohnson merged 1 commit intomainfrom
rolling-trace
Dec 15, 2022
Merged

Implement rolling trace log#226
benbjohnson merged 1 commit intomainfrom
rolling-trace

Conversation

@benbjohnson
Copy link
Collaborator

This pull request changes the "trace log" so that it can be written to disk and the logs will automatically be rolled. Trace logging can produce A LOT of data quickly but we typically only care about very recent logs when an issue occurs.

Usage

The existing -tracing flag still works and can be used to enable the trace log via STDOUT. There is also a new tracing config section for enabling the trace log printing to disk:

# The tracing section enables a rolling, on-disk tracing log. This records every
# operation to the database so it can be verbose and it can degrade performance.
# This is for debugging only and should not be enabled in production.
tracing:
  # Output path on disk.
  path: "/path/to/trace.log"

  # Maximum size of a single trace log before rolling. Specified in megabytes.
  max-size: 64

  # Maximum number of trace logs to retain.
  max-count: 10

  # If true, historical logs will be compressed using gzip.
  compress: true

This default configuration will produce a file called /path/to/trace.log and once that log reaches 64MB then it will be rolled over to a new file with a time-based name (e.g. /path/to/trace.2022-12-15T14-11-07.991.log.gz). Once 10 logs files have been produced, the oldest one will be deleted when a new log file is written.

@benbjohnson benbjohnson added this to the v0.3.0 milestone Dec 15, 2022
@benbjohnson benbjohnson merged commit 9c75cb7 into main Dec 15, 2022
@benbjohnson benbjohnson deleted the rolling-trace branch December 15, 2022 14:27
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.

1 participant