Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I specify different level for appenders? #34

Closed
imbear opened this issue Dec 1, 2016 · 3 comments
Closed

Can I specify different level for appenders? #34

imbear opened this issue Dec 1, 2016 · 3 comments

Comments

@imbear
Copy link

imbear commented Dec 1, 2016

For example, "Info" for console, "Trace" for file, etc.

@sfackler
Copy link
Collaborator

sfackler commented Dec 1, 2016

Yep, you can attach a threshold filter to them!

@imbear
Copy link
Author

imbear commented Dec 1, 2016

I tried like below:

refresh_rate: 30 seconds
appenders:
  stdout:
    kind: console
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S)} [{h({l})}] {m}{n}"
  decode:
    kind: file
    path: "log/debug.log"
    append: false
    filters:
      -
        kind: threshold
        level: debug
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S)} [{l}] - {M} - {m}{n}"
root:
  level: info
  appenders:
    - stdout
    - decode

But got a error:

log4rs: error deserializing component: no filter deserializer for kind threshold registered

Solved:
Should add the "threshold_filter" to Cargo.toml:

log4rs = { version = "*", features = ["threshold_filter"] }

@sfackler
Copy link
Collaborator

sfackler commented Dec 1, 2016

Yep, it's not part of the default feature set. Glad you got it working!

@sfackler sfackler closed this as completed Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants