Skip to content

Commit

Permalink
Fix Capistrano tasks not logging anything
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tombruijn committed Sep 26, 2024
1 parent 5f2acb5 commit 089d032
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changesets/fix-no-logs-appearing-from-capistrano-tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: patch
type: fix
---

Fix no AppSignal internal logs being logged from Capistrano tasks.
3 changes: 2 additions & 1 deletion lib/appsignal/integrations/capistrano/appsignal.cap
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ namespace :appsignal do
appsignal_config = Appsignal::Config.new(
Dir.pwd,
appsignal_env,
Logger.new(StringIO.new)
Appsignal.internal_logger
).tap do |c|
c.merge_dsl_options(fetch(:appsignal_config, {}))
c.validate
end
Appsignal._start_logger

if appsignal_config&.active?
marker_data = {
Expand Down
3 changes: 2 additions & 1 deletion lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ def self.tasks(config)
appsignal_config = Appsignal::Config.new(
ENV.fetch("PWD", nil),
env,
Appsignal::Utils::IntegrationLogger.new(StringIO.new)
Appsignal.internal_logger
).tap do |c|
c.merge_dsl_options(fetch(:appsignal_config, {}))
c.validate
end
Appsignal._start_logger

if appsignal_config&.active?
marker_data = {
Expand Down

0 comments on commit 089d032

Please sign in to comment.