Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A highly configurable logging framework for Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

estk/log4rs

Repository files navigation

docscrates.ioLicense: MIT OR Apache-2.0Minimum rustc versionCI

log4rs is a highly configurable logging framework modeled after Java's Logbackand log4j libraries.

Quick Start

log4rs.yaml:

refresh_rate:30 secondsappenders:stdout:kind:consolerequests:kind:filepath:"log/requests.log"encoder:pattern:"{d} - {m}{n}"root:level:warnappenders:    -stdoutloggers:app::backend::db:level:infoapp::requests:level:infoappenders:      -requestsadditive:false

lib.rs:

use log::{error, info, warn};use log4rs;fnmain(){    log4rs::init_file("config/log4rs.yaml",Default::default()).unwrap();info!("booting up");// ...}

Rust Version Requirements

1.75

Building for Dev

  • Run the tests:cargo test --all-features
  • Run the tests for windows withcross:cross test --target x86_64-pc-windows-gnu
  • Run the tests for all individual features:./test.sh
  • Run the tests for all individual features for windows withcross:./test.sh win

Compression

If you are using the file rotation in your configuration there is a knownsubstantial performance issue with either thegzip orzstdfeatures. When rolling files it will zip log archives automatically. This isa problem when the log archives are large as the zip process occurs inthe main thread and will halt the process until the zip processcompletes.

The methods to mitigate this are as follows.

  1. Use thebackground_rotation feature which spawns an os thread to do the compression.
  2. Do not enable thegzip nor thezstd features.
  3. Ensure the archives are small enough that the compression time is acceptable.

For more information see the PR that addedbackground_rotation.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submittedfor inclusion in the work by you shall be dual licensed as above, without anyadditional terms or conditions.

About

A highly configurable logging framework for Rust

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors55


[8]ページ先頭

©2009-2025 Movatter.jp