Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing the log #118

Closed
ageorgou opened this issue Jul 14, 2022 · 2 comments
Closed

Clearing the log #118

ageorgou opened this issue Jul 14, 2022 · 2 comments

Comments

@ageorgou
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Suggested by @stinney. Over time, the log file can get very long, which makes it much harder to look through it for debugging.

Describe the solution you'd like
Various possibilities:

  • When writing to the log, check its age or size and delete/truncate if over a certain threshold.
  • Add a command to clear the log (and add a suggestion to do so in the documentation for reporting problems)
  • Suggest to users that they delete the file before retrying a command and sharing the log.

Describe alternatives you've considered
See above. Or perhaps our logging configuration already takes care of that?

Additional context
If we want to rotate the log file, there is an option to limit how many old files are kept.

@giordano
Copy link
Collaborator

We are already doing log rotation by setting maxsize in winston.transports.File:

nisaba/src/logger.ts

Lines 60 to 63 in 89a5d6c

new winston.transports.File({
filename: filename,
maxsize: 20000000,
}),
So the threshold size is 20000000 bytes (~ 19 MiB). Concretely, is the suggestion to reduce the threshold? For example, my log file has currently 324 KiB (in 6352 lines), so filling up 19 MiB will take quite some more time, but I don't think we want to spread the log over several small files (say, less than 1 MiB).

@ageorgou
Copy link
Contributor Author

Since we already rotate the file (I had forgotten!), I think this is fine. Have added a note in #12 to allow customising the maximum log size we retain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants