Skip to content

How to add Windows environment variable into path parameter #406

Open
@Zhirui-Zhang

Description

@Zhirui-Zhang

Operating System: Windows 10

Question:
I want to modify log4rs.yaml like this but don't know how to realize

appenders:
    rollingfile:
        kind: rolling_file
        path: "%LOCALAPPDATA%/testFolder/Logs/Proxy.log"
        encoder:
            pattern: "[{d(%Y-%m-%dT%H:%M:%S%.6f)} {h({l}):<5.5} {M}] {m}{n}"
        policy:
            kind: compound    
            trigger:
                kind: size
                limit: 5 mb
            roller:
                kind: fixed_window
                pattern: "%LOCALAPPDATA%/testFolder/Logs/Proxy-{}.log"
                base: 0
                count: 3
root:
    level: DEBUG
    appenders:
        - rollingfile

For path and pattern, I want to use system environment variable like %LOCALAPPDATA% or %USERNAME% or %USERPROFILE% (doestn't matter) instead of absolute path.
But seems like it doestn't recognize environment variable and create %LOCALAPPDATA% folder in current working path finally, how can I fix it, thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions