I developed some stuff in rust and I log some errors or warnings. I 'm using systemd_journal_logger lib to do the job. It works fine until I compile and try to use relase binary. As debug symbols are not present in it and it simply cannot log. Is there an way to make log work in this case ?
I discovered that shared_memory lib causes it
I have a simple example
use log::LevelFilter;
fn main() {
systemd_journal_logger::init().unwrap();
log::set_max_level( LevelFilter::Debug);
log::warn!("A warning.");
log::error!("An error");
}
In my Cargo.toml I have
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
log = "=0.4.14"
systemd-journal-logger = "=0.3.1"
running it with
cargo run
./target/debug/mytest
or even
./target/release/mytest
works perfectly looking at journal
journalctl -f
But if I include
shared_memory = "0.12.2"
as a dependency
cargo build --release
./target/release/mytest
stops working
Ou, this is mean. shared_memory sets
[features]
default = ["log/release_max_level_off"]
This has since been fixed but not released, you can avoid the problem by downgrading the shared_memory version to <0.12.2, or carefully disabling the default features without breaking shared_memory's build…
shared_memory = { version = "0.12.2", default_features = false, features = ["log"] }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With