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

Fix internal logger in Capistrano tasks and remove Config logger instance #1306

Merged
merged 4 commits into from
Sep 27, 2024

Conversation

tombruijn
Copy link
Member

@tombruijn tombruijn commented Sep 26, 2024

Use internal logger from in transmitter

The transmitter logged partially through the Appsignal.internal_logger and the logger from the Config class. Make this consistent, like any other place in the gem, by logging via Appsignal.internal_logger.

Fix Capistrano tasks not logging anything

The loggers given to the Config class in the Capistrano tasks write to a StringIO which is never read afterwards. Call _start_logger to initialize the logger and write the buffered log messages either to STDOUT or the AppSignal log file after the config has loaded.

Remove logger from config class

Directly access the Appsignal.internal_logger method instead of the Config class having its own logger instance that could be different from the configured logger.

Assert the logger works in Capistrano

Follow up on the previous commits to remove the logger instance from the Config class, which was set by Capistrano.

It didn't actually log anything before, as it wrote to a StringIO.new. Log now to the configured logger based on the application's config.

I see no harm in making the logger work. By default it will log to the appsignal.log file. If apps have configured it to log to stdout, they have deliberately configured that so there should be no problem.

The transmitter logged partially through the `Appsignal.internal_logger`
and the logger from the Config class.
Make this consistent, like any other place in the gem, by logging via
`Appsignal.internal_logger`.
@tombruijn tombruijn self-assigned this Sep 26, 2024
The loggers given to the Config class in the Capistrano tasks write to a
StringIO which is never read afterwards. Call `_start_logger` to
initialize the logger and write the buffered log messages either to
STDOUT or the AppSignal log file after the config has loaded.
Directly access the `Appsignal.internal_logger` method instead of the
Config class having its own logger instance that could be different from
the configured logger.
@tombruijn tombruijn changed the title Refactor logger usage Fix internal logger in Capistrano tasks and remove Config logger instance Sep 26, 2024
Follow up on the previous commits to remove the logger instance from the
Config class, which was set by Capistrano.

It didn't actually log anything before, as it wrote to a `StringIO.new`.
Log now to the configured logger based on the application's config.

I see no harm in making the logger work. By default it will log to the
`appsignal.log` file. If apps have configured it to log to stdout, they
have deliberately configured that so there should be no problem.
@tombruijn tombruijn merged commit d81bbdf into main Sep 27, 2024
122 checks passed
@tombruijn tombruijn deleted the refactor-logger branch September 27, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants