Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Feature] Support local timezone and compression in rolling file appender (inspired by logroller) #1688

@ghjdegithub

Description

@ghjdegithub

Feature Request

Is your feature request related to a problem? Please describe.

When using tracing-appender for rolling file logs, the rotation strategy (e.g., daily) defaults to UTC time, causing mismatches in log filenames with local dates in non-UTC timezones (e.g., Asia/Shanghai at UTC+8). Additionally, there's no built-in support for log compression (e.g., gzip), leading to rapid disk space consumption in high-volume logging scenarios.

Describe the solution you'd like

Add configurable timezone support for rolling (e.g., via chrono-tz integration for local or custom timezones like Tz::Asia__Shanghai) and optional compression formats (e.g., gzip on rotation). This could draw inspiration from or partially integrate features from the logroller crate, which already handles these seamlessly while maintaining compatibility with tracing subscribers.

Describe alternatives you've considered

Switching to third-party crates like logroller (for timezone and compression) or tracing-appender-plus (for local time support), but these introduce additional dependencies and potential API inconsistencies. Native enhancements would simplify adoption without forking or migrating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions