1.9 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| configured-logger-file-open-failures | api | runtime | 20260512 | Read the number of open failures recorded by the configured runtime file sink. |
|
Configured-logger-file-open-failures
Read the number of open failures recorded by a ConfiguredLogger file sink. This helper is useful for diagnosing file-availability or reopen problems.
Interface
pub fn ConfiguredLogger::file_open_failures(self : ConfiguredLogger) -> Int {}
input
self : ConfiguredLogger- Config-driven runtime logger whose open-failure counter should be inspected.
output
Int- Number of recorded open failures.
Explanation
Detailed rules explaining key parameters and behaviors
- File-backed sinks report their recorded open-failure count.
- Queued file sinks forward the metric from the wrapped file sink.
- Non-file sinks return
0. - The counter is cumulative until reset.
How to Use
Here are some specific examples provided.
When Need File Availability Diagnostics
When operators should see whether file open or reopen failed:
let count = logger.file_open_failures()
In this example, the configured logger exposes the open-failure metric directly.
When Validate Recovery Logic
When tests or support code should inspect whether reopen attempts failed:
ignore(logger.file_open_failures())
In this example, the counter helps confirm whether file-open problems occurred during runtime.
Error Case
e.g.:
-
If the configured sink is not file-backed, the method returns
0. -
If callers need the full file status snapshot rather than one counter,
file_state()is the better API.
Notes
-
Use this helper for focused file-open diagnostics.
-
Pair it with
file_reopen(...)andfile_available()during recovery analysis.