Skip to content

Conversation

daipom
Copy link
Contributor

@daipom daipom commented Jul 29, 2025

Which issue(s) this PR fixes:

What this PR does / why we need it:
In #5008, we have added a new feature force_stacktrace_level.
However, it was not applied to PluginLogger.
So, depending on the settings and error locations, force_stacktrace_level could not work.
This PR fixes it.

Docs Changes:
Not needed because #5008 is not released yet.

Release Note:
Not needed because #5008 is not released yet.

How to reproduce the bug:

conf:

<system>
  <log>
    forced_stacktrace_level info
  </log>
</system>

<source>
  @type sample
  @id test
  tag test.fail
</source>

<match test.fail>
  @type null
  @id null
  never_flush
  <buffer>
    flush_mode interval
    flush_interval 1s
  </buffer>
</match>
  • Set @id to use PluginLogger.
  • Use buffer to use PluginLogger.
    • Without buffer, RootAgent outputs the logs for flushing errors by using the global logger. (RootAgent#handle_emits_error)

log:

2025-07-29 12:39:36 +0900 [info]: #0 fluentd worker is now running worker=0
2025-07-29 12:39:38 +0900 [warn]: #0 [null] failed to flush the buffer. retry_times=0 next_retry_time=2025-07-29 12:39:39 +0900 chunk="63b09284c334efa1927547b5623268ff" error_class=RuntimeError error="failed to flush"
  2025-07-29 12:39:38 +0900 [warn]: #0 /home/daipom/work/fluentd/fluentd/lib/fluent/plugin/out_null.rb:59:in `write'
  2025-07-29 12:39:38 +0900 [warn]: #0 /home/daipom/work/fluentd/fluentd/lib/fluent/plugin/output.rb:1212:in `try_flush'
  2025-07-29 12:39:38 +0900 [warn]: #0 /home/daipom/work/fluentd/fluentd/lib/fluent/plugin/output.rb:1527:in `flush_thread_run'
  2025-07-29 12:39:38 +0900 [warn]: #0 /home/daipom/work/fluentd/fluentd/lib/fluent/plugin/output.rb:490:in `block (2 levels) in start'
  2025-07-29 12:39:38 +0900 [warn]: #0 /home/daipom/work/fluentd/fluentd/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
  • The log levels of stacktraces are warn, although forced_stacktrace_level is info.

@daipom daipom added this to the v1.19.0 milestone Jul 29, 2025
@daipom daipom added the bug Something isn't working label Jul 29, 2025
@daipom daipom requested review from Watson1978 and kenhys July 29, 2025 04:19
Copy link
Contributor

@Watson1978 Watson1978 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Copy link
Contributor

@kenhys kenhys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kenhys kenhys merged commit d4fd43b into fluent:master Jul 29, 2025
17 checks passed
@daipom daipom deleted the force_stacktrace_level-fix-plugin-logger branch July 29, 2025 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants