Skip to content

command: fix NoMethodError of --daemon under Windows - #4716

Merged
daipom merged 1 commit into
fluent:masterfrom
Watson1978:windows/daemon
Nov 26, 2024
Merged

command: fix NoMethodError of --daemon under Windows#4716
daipom merged 1 commit into
fluent:masterfrom
Watson1978:windows/daemon

Conversation

@Watson1978

@Watson1978 Watson1978 commented Nov 26, 2024

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #4354

What this PR does / why we need it:
To daemonize the process, the following code will be invoked on Windows:

ServerEngine::Daemon.run_server(server_module, worker_module) { Fluent::Supervisor.serverengine_config(params) }

$log variable does not exist because it has not executed Superviser#setup_global_logger method until here.
It will perform a new startup process and prepare a logger in

ServerEngine::Daemon.run_server(server_module, worker_module) { Fluent::Supervisor.serverengine_config(params) }

This patch will only avoid the error since a logger is not required this process.

Docs Changes:
Not needed.

Release Note:
The same as the title.

@Watson1978
Watson1978 force-pushed the windows/daemon branch 2 times, most recently from 42435bf to ace524e Compare November 26, 2024 06:15
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978 Watson1978 changed the title daemon: setup global logger on Windows supervisor: avoid method calling on nil with --daemon flag under Windows Nov 26, 2024
@Watson1978
Watson1978 marked this pull request as ready for review November 26, 2024 06:32
@Watson1978
Watson1978 requested a review from daipom November 26, 2024 06:32
@daipom daipom added this to the v1.18.0 milestone Nov 26, 2024
@daipom

daipom commented Nov 26, 2024

Copy link
Copy Markdown
Contributor

Thanks!

Note:

@daipom daipom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@daipom daipom added the backport to v1.16 We will backport this fix to the LTS branch label Nov 26, 2024
@daipom daipom changed the title supervisor: avoid method calling on nil with --daemon flag under Windows supervisor: fix NoMethodError of --daemon under Windows Nov 26, 2024
@daipom daipom changed the title supervisor: fix NoMethodError of --daemon under Windows command: fix NoMethodError of --daemon under Windows Nov 26, 2024
@daipom
daipom merged commit 713b738 into fluent:master Nov 26, 2024
@Watson1978
Watson1978 deleted the windows/daemon branch November 27, 2024 00:35
daipom pushed a commit that referenced this pull request Jan 29, 2025
…4796)

**Which issue(s) this PR fixes**: 

Backport #4716 

**What this PR does / why we need it**: 
To daemonize the process, the following code will be invoked on Windows:

https://github.com/fluent/fluentd/blob/89f0a76fb2e050659f0a503823beb2ad8cf899eb/lib/fluent/daemon.rb#L13

$log variable does not exist because it has not executed
`Superviser#setup_global_logger` method until here.
It will perform a new startup process and prepare a logger in

https://github.com/fluent/fluentd/blob/89f0a76fb2e050659f0a503823beb2ad8cf899eb/lib/fluent/daemon.rb#L13

This patch will only avoid the error since a logger is not required this
process.

**Docs Changes**:
Not needed.

**Release Note**: 
The same as the title.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
Co-authored-by: Watson <fujita@clear-code.com>
@kenhys kenhys added the backported "backport to LTS" is done label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport to v1.16 We will backport this fix to the LTS branch backported "backport to LTS" is done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: cannot launch Fluentd with --daemon

3 participants