Skip to content

Conversation

@ishaish103
Copy link

Link to tracking issue

Fixes #10472

@ishaish103 ishaish103 requested review from a team and andrzej-stencel as code owners November 15, 2025 03:01
@github-actions github-actions bot added the exporter/debug Issues related to the Debug exporter label Nov 15, 2025
@andrzej-stencel andrzej-stencel changed the title [chore] add ability to set output_paths [exporter/debug] add ability to set output_paths Nov 17, 2025
Copy link
Member

@andrzej-stencel andrzej-stencel left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @ishaish103! I added a couple suggestions for the docs and the tests.

Refer to [Zap docs](https://godoc.org/go.uber.org/zap/zapcore#NewSampler) for more details
on how sampling parameters impact number of messages.
- `use_internal_logger` (default = `true`): uses the collector's internal logger for output. See [below](#using-the-collectors-internal-logger) for description.
- `output_paths` (default = `["stdout"]`): a list of URLs or file paths to write logging output to. This option is only used when `use_internal_logger` is `false`. The URLs could only be with "file" schema or without schema. The URLs with "file" schema must be an absolute path. The URLs without schema are treated as local file paths. "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr.
Copy link
Member

Choose a reason for hiding this comment

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

Let's not mention "URLs", it may be confusing to users. I propose to officially support only bare file paths, regardless of what is internally supported by Zap.

Copy link
Author

Choose a reason for hiding this comment

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

ok, ill also add validation for the paths as well to validate that its not one of the following:
file:///path/to/file (contains ://)
http://example.com (contains ://)
file:path/to/file (matches scheme: pattern)

return cfg
}(),
},
{
Copy link
Member

Choose a reason for hiding this comment

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

Please add a test case for when user sets output_paths but does not set use_internal_logger to false.

What should happen then? Shouldn't such config be invalid?

Copy link
Author

Choose a reason for hiding this comment

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

basically the same thing:
throw an error if out_paths is null and set_intenral_logger is false

return cfg
}(),
},
{
Copy link
Member

Choose a reason for hiding this comment

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

Please add a test case for when user sets output_paths to an empty array.

What should happen then? Shouldn't such config be invalid?

Copy link
Author

Choose a reason for hiding this comment

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

good catch, ill validate it and throw an error if out_paths is null and set_intenral_logger is false

@ishaish103
Copy link
Author

@andrzej-stencel Hey :)
ive updated the code, can you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exporter/debug Issues related to the Debug exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[exporter/debug] make the output stream configurable when use_internal_logger is false

2 participants