From 66af56722f4b05703a591543940ba73485f8a4ca Mon Sep 17 00:00:00 2001 From: estk Date: Tue, 10 Mar 2020 12:25:10 -0700 Subject: [PATCH] Add back gzip to default features update docs (#144) * Add back gzip to default features update docs --- Cargo.toml | 2 +- README.md | 17 ++++++++++++++++- benches/rotation.rs | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 429640ba..ebb07434 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["log", "logger", "logging", "log4"] edition = '2018' [features] -default = ["all_components", "file", "yaml_format"] +default = ["all_components", "file", "yaml_format", "gzip"] file = ["humantime", "serde", "serde_derive", "serde-value", "typemap", "log/serde"] yaml_format = ["serde_yaml"] diff --git a/README.md b/README.md index bff4f565..0686e48b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,22 @@ log4rs is a highly configurable logging framework modeled after Java's Logback and log4j libraries. -[Documentation](https://docs.rs/log4rs) +### Warning + +If you are using the file rotation in your configuration there is a known substantial performance issue so listen up! +By default the `gzip` feature is enabled and when rolling files it will zip log archives automatically. This is a problem +when the log archives are large as the zip happens in the main thread and will halt the process while the zip is completed. +Be advised that the `gzip` feature will be removed from default features as of `1.0`. + +The methods to mitigate this are as follows. + +1. Use the `background_rotation` feature which spawns an os thread to do the compression. +1. Disable the `gzip` feature with `--no-default-features`. +1. Ensure the archives are small enough that the compression time is acceptable. + +For more information see the PR that added (`background_rotation`)[https://github.com/estk/log4rs/pull/117]. + +## Quick Start log4rs.yaml: ```yaml diff --git a/benches/rotation.rs b/benches/rotation.rs index ed440295..1a7dbcc3 100644 --- a/benches/rotation.rs +++ b/benches/rotation.rs @@ -36,6 +36,7 @@ fn bench_find_anomalies() { let dur = now.elapsed(); if i > 100 + && dur.as_millis() > 10 && dur.as_micros() as u64 > (online.mean() + (online.stddev() * 50_f64)).round() as u64 { anomalies.push(dur);