Log not being rotated
Closed this issue · 5 comments
If your bug is about how AppSignal works in your app specifically we recommend you contact us at support@appsignal.com with your bug report instead.
Describe the bug
log/appsignal.log
grows forever until containers run out of space, it looks like Appsignal.logger#logdev
has a max size of 10Mb, but because it doesn't have a max age set, the size is never being checked and the log isn't being rotated (https://github.com/ruby/logger/blob/master/lib/logger/log_device.rb#L128)
Logger has shift_size
set and should be rotating:
To Reproduce
Steps to reproduce the behavior:
- AppSignal for Ruby gem version 3.5.2
- Rails 7.0.4
We use Semantic Logger, but that shouldn't be relevant since AppSignal logger sets up its own logger. Just let the app run long enough and the log will never be rotated.
It seems the integration logger is set to the debug level. Have you configured AppSignal log level to be trace
or debug
?
@luismiramirez We use debug log level because we use AppSignal for centralized logging and want debug logging, but — regardless of log level — the log isn't being rotated, so given enough time the same would happen with a different log level, no?
@Amnesthesia I mean the AppSignal log level, which can be set via this config option. That log level set to debug is only useful for support purposes when something is wrong with the integration. It's a log of how the AppSignal works internally.
If it's not set to debug, it'll usually be a few lines long at most (3 lines per app boot). For log rotation, you can use logrotate
; we do that ourselves for our applications.
Let's rename the internal logger Appsignal.logger
to be _logger
or internal_logger
to avoid confusion in the future. There should be no need to enable any log level more verbose than "info" on most installs.
We will not enable auto log rotation because our agent also logs to the same file. On the info log level the logs from our integrations are very minimal per app boot and would not require immediate log rotation unless an app is deployed very often.