You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "hubcio (via GitHub)" <gi...@apache.org> on 2026/09/29 22:07:03 UTC
[PR] fix(server): make logging honor retention, level, path and file_enabled [iggy]
hubcio opened a new pull request, #4354:
URL: https://github.com/apache/iggy/pull/4354
Hourly rotation filled the max_total_size / max_file_size archive
slots (8 by default) with small files. A server kept about 9 hours
of logs, and retention never deleted anything. Rotation is now by
size only, which matches the config comments.
EnvFilter reads a bare word that is not a level as a target, so a
typo in logging.level or "none" turned off every log line.
LogFilter now parses the level strictly in the validator and in
late_init, and an invalid value fails the boot.
file_enabled = false no longer buffers every log line in memory.
A relative logging.path no longer depends on the working directory.
retention = 0 now keeps rotated files forever. A retention above
about 56 years no longer panics the rotation thread and stops the
server. [span] directives now work while telemetry is off.
Upgrade notes: log files no longer rotate every hour. A config with
level = "none" or a bare target name no longer boots.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(server): make logging honor retention, level, path and file_enabled [iggy]
Posted by "spetz (via GitHub)" <gi...@apache.org>.
spetz commented on code in PR #4354:
URL: https://github.com/apache/iggy/pull/4354#discussion_r4147377027
##########
core/integration/tests/server/scenarios/log_rotation_scenario.rs:
##########
@@ -126,6 +129,94 @@ async fn log_rotation_should_be_valid(present_log_config: LogRotationTestConfig)
run(&harness, &log_dir, present_log_config).await;
}
+#[tokio::test]
+#[parallel]
+async fn given_log_path_existing_in_working_directory_when_server_starts_should_log_under_data_path()
+ {
+ // The server inherits this working directory, so this directory has the
+ // same relative path as the configured log directory.
+ let decoy = tempfile::Builder::new()
+ .prefix("iggy-logs-")
+ .tempdir_in(".")
Review Comment:
The decoy directory is created in the working directory of the test process, which is `core/integration/` inside the checkout, and `iggy-logs-*` is not covered by `.gitignore`. `TempDir` cleans up only on drop, so a run that nextest terminates after its slow timeout, or one stopped with Ctrl+C, leaves an untracked directory in the source tree.
##########
core/server_common/src/log/settings.rs:
##########
@@ -39,6 +41,67 @@ pub struct LoggingSettings {
pub retention: IggyDuration,
}
+/// `logging.level` in the `RUST_LOG` syntax, parsed more strictly than
+/// `EnvFilter::new` does. `EnvFilter` reads a bare word that is not a level
+/// as a target name and enables only that target, so a typo such as `inof`
+/// turned off every log line, errors included, without a warning.
+#[derive(Debug)]
+pub struct LogFilter(EnvFilter);
+
+#[derive(Debug, thiserror::Error)]
+pub enum LogFilterError {
+ #[error("no filter directive")]
+ Empty,
+
+ #[error(
+ "`{0}` is not a log level (trace, debug, info, warn, error or off); write `{0}=<level>` to filter one target"
+ )]
+ NotALevel(String),
+
+ #[error(transparent)]
+ InvalidDirective(#[from] ParseError),
+}
+
+/// The 0.8.0 and 0.9.0 `config.toml` listed `none` as a level, but `tracing`
+/// has no such level.
+const NONE_LEVEL_ALIAS: &str = "none";
+const OFF_LEVEL: &str = "off";
+
+impl FromStr for LogFilter {
+ type Err = LogFilterError;
+
+ fn from_str(level: &str) -> Result<Self, Self::Err> {
+ // `EnvFilter` mis-parses a directive with spaces around it.
+ let directives: Vec<&str> = level
+ .split(',')
+ .map(str::trim)
+ .filter(|directive| !directive.is_empty())
+ .map(|directive| {
+ if directive.eq_ignore_ascii_case(NONE_LEVEL_ALIAS) {
+ OFF_LEVEL
+ } else {
+ directive
+ }
+ })
+ .collect();
+ if directives.is_empty() {
+ return Err(LogFilterError::Empty);
+ }
+ if let Some(word) = directives.iter().copied().find(|directive| {
+ !directive.contains(['=', '[']) && directive.parse::<LevelFilter>().is_err()
+ }) {
+ return Err(LogFilterError::NotALevel(word.to_owned()));
+ }
+ Ok(Self(EnvFilter::builder().parse(directives.join(","))?))
Review Comment:
This strict parse makes every malformed directive fail the boot, but the upgrade notes in the commit message list a bare target name as the only value that no longer boots. `EnvFilter::new` parsed lossily, so a config such as `level = "info,server=verbose"` printed an "ignoring" line to stderr and started at `info`. `EnvFilter::builder().parse` returns `InvalidDirective` for the same value, and the validator in `core/configs/src/common/validators.rs:97` turns that into a failed boot.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(server)!: make logging honor retention, level, path and file_enabled [iggy]
Posted by "spetz (via GitHub)" <gi...@apache.org>.
spetz merged PR #4354:
URL: https://github.com/apache/iggy/pull/4354
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(server): make logging honor retention, level, path and file_enabled [iggy]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #4354:
URL: https://github.com/apache/iggy/pull/4354#issuecomment-5900273616
## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/4354?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `96.52174%` with `8 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 75.27%. Comparing base ([`1f5d215`](https://app.codecov.io/gh/apache/iggy/commit/1f5d215b08269d3ff2b0efa72571d70ec53b89dc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`7f760c2`](https://app.codecov.io/gh/apache/iggy/commit/7f760c2b64825a1073e7f78c1fa8a3c9c3e3ad3d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/4354?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [core/server\_common/src/log/logger.rs](https://app.codecov.io/gh/apache/iggy/pull/4354?src=pr&el=tree&filepath=core%2Fserver_common%2Fsrc%2Flog%2Flogger.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXJfY29tbW9uL3NyYy9sb2cvbG9nZ2VyLnJz) | 96.57% | [1 Missing and 4 partials :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4354?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [core/server\_common/src/log/settings.rs](https://app.codecov.io/gh/apache/iggy/pull/4354?src=pr&el=tree&filepath=core%2Fserver_common%2Fsrc%2Flog%2Fsettings.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXJfY29tbW9uL3NyYy9sb2cvc2V0dGluZ3MucnM=) | 92.68% | [1 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4354?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #4354 +/- ##
=============================================
- Coverage 87.78% 75.27% -12.52%
Complexity 1575 1575
=============================================
Files 1288 1286 -2
Lines 227275 211379 -15896
Branches 190712 174816 -15896
=============================================
- Hits 199518 159118 -40400
- Misses 23059 47548 +24489
- Partials 4698 4713 +15
```
| [Components](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [Rust Core](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.64% <96.52%> (-15.25%)` | :arrow_down: |
| [Java SDK](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `68.68% <ø> (ø)` | |
| [C# SDK](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.40% <ø> (ø)` | |
| [Python SDK](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `91.00% <ø> (ø)` | |
| [PHP SDK](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.67% <ø> (ø)` | |
| [Node SDK](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `96.58% <ø> (ø)` | |
| [Go SDK](https://app.codecov.io/gh/apache/iggy/pull/4354/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.31% <ø> (+0.02%)` | :arrow_up: |
| [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/4354?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [core/configs/src/common/validators.rs](https://app.codecov.io/gh/apache/iggy/pull/4354?src=pr&el=tree&filepath=core%2Fconfigs%2Fsrc%2Fcommon%2Fvalidators.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9jb25maWdzL3NyYy9jb21tb24vdmFsaWRhdG9ycy5ycw==) | `81.40% <100.00%> (+9.70%)` | :arrow_up: |
| [core/server\_common/src/log/settings.rs](https://app.codecov.io/gh/apache/iggy/pull/4354?src=pr&el=tree&filepath=core%2Fserver_common%2Fsrc%2Flog%2Fsettings.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXJfY29tbW9uL3NyYy9sb2cvc2V0dGluZ3MucnM=) | `89.36% <92.68%> (+22.69%)` | :arrow_up: |
| [core/server\_common/src/log/logger.rs](https://app.codecov.io/gh/apache/iggy/pull/4354?src=pr&el=tree&filepath=core%2Fserver_common%2Fsrc%2Flog%2Flogger.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXJfY29tbW9uL3NyYy9sb2cvbG9nZ2VyLnJz) | `86.50% <96.57%> (+8.25%)` | :arrow_up: |
... and [282 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/4354/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org