Skip to content

Commit

Permalink
Add back gzip to default features update docs (#144)
Browse files Browse the repository at this point in the history
* Add back gzip to default features update docs
  • Loading branch information
estk authored Mar 10, 2020
1 parent 4b9909d commit 66af567
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions benches/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 66af567

Please sign in to comment.