{"id":13439770,"url":"https://github.com/estk/log4rs","last_synced_at":"2025-03-20T08:32:03.245Z","repository":{"id":26473036,"uuid":"29924745","full_name":"estk/log4rs","owner":"estk","description":"A highly configurable logging framework for Rust","archived":false,"fork":false,"pushed_at":"2024-04-18T05:24:32.000Z","size":2616,"stargazers_count":945,"open_issues_count":52,"forks_count":142,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-05-02T00:05:32.152Z","etag":null,"topics":["json","log","logging","rust","xml"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["estk"]}},"created_at":"2015-01-27T17:09:19.000Z","updated_at":"2024-06-18T15:13:22.503Z","dependencies_parsed_at":"2023-12-06T03:06:58.937Z","dependency_job_id":"d3e71229-eeb5-426d-a04a-b3d2c9f82381","html_url":"https://github.com/estk/log4rs","commit_stats":{"total_commits":448,"total_committers":38,"mean_commits":"11.789473684210526","dds":0.2946428571428571,"last_synced_commit":"55446882c82c4a48e89917ed9ac62610a8fe797f"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estk%2Flog4rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estk%2Flog4rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estk%2Flog4rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estk%2Flog4rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estk","download_url":"https://codeload.github.com/estk/log4rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244578023,"owners_count":20475392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","log","logging","rust","xml"],"created_at":"2024-07-31T03:01:16.957Z","updated_at":"2025-03-20T08:32:02.694Z","avatar_url":"https://github.com/estk.png","language":"Rust","readme":"# log4rs\n\n[![docs](https://docs.rs/log4rs/badge.svg)](https://docs.rs/log4rs)\n[![crates.io](https://img.shields.io/crates/v/log4rs.svg)](https://crates.io/crates/log4rs)\n[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](#license)\n![CI](https://github.com/estk/log4rs/workflows/CI/badge.svg)\n[![Minimum rustc version](https://img.shields.io/badge/rustc-1.69+-green.svg)](https://github.com/estk/log4rs#rust-version-requirements)\n\nlog4rs is a highly configurable logging framework modeled after Java's Logback\nand log4j libraries.\n\n## Quick Start\n\nlog4rs.yaml:\n\n```yaml\nrefresh_rate: 30 seconds\nappenders:\n  stdout:\n    kind: console\n  requests:\n    kind: file\n    path: \"log/requests.log\"\n    encoder:\n      pattern: \"{d} - {m}{n}\"\nroot:\n  level: warn\n  appenders:\n    - stdout\nloggers:\n  app::backend::db:\n    level: info\n  app::requests:\n    level: info\n    appenders:\n      - requests\n    additive: false\n```\n\nlib.rs:\n\n```rust\nuse log::{error, info, warn};\nuse log4rs;\n\nfn main() {\n    log4rs::init_file(\"config/log4rs.yaml\", Default::default()).unwrap();\n\n    info!(\"booting up\");\n\n    // ...\n}\n```\n\n## Rust Version Requirements\n\n1.69\n\n## Building for Dev\n\n* Run the tests: `cargo test --all-features`\n* Run the tests for windows with [cross](https://github.com/rust-embedded/cross):\n  `cross test --target x86_64-pc-windows-gnu`\n* Run the tests for all individual features: `./test.sh`\n* Run the tests for all individual features for windows with\n  [cross](https://github.com/rust-embedded/cross): `./test.sh win`\n\n\n## Compression\n\nIf you are using the file rotation in your configuration there is a known\nsubstantial performance issue with the `gzip` feature. When rolling files \nit will zip log archives automatically. This is a problem when the log archives\nare large as the zip happens in the main thread and will halt the process while\nthe zip is completed.\n\nThe methods to mitigate this are as follows.\n\n1. Use the `background_rotation` feature which spawns an os thread to do the compression.\n2. Do not enable the `gzip` feature.\n3. Ensure the archives are small enough that the compression time is acceptable.\n\nFor more information see the PR that added [`background_rotation`](https://github.com/estk/log4rs/pull/117).\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you shall be dual licensed as above, without any\nadditional terms or conditions.\n","funding_links":["https://github.com/sponsors/estk"],"categories":["Libraries","Rust","库 Libraries","tools"],"sub_categories":["Logging","日志记录 Logging"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festk%2Flog4rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festk%2Flog4rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festk%2Flog4rs/lists"}