Print to stderr from panic handler in LogPlugin (#11170)

# Objective

When panic handler prints to stdout instead of stderr, I've observed two
outcomes with this PR test #11169:
- Sometimes output is mixed up, so it is not clear where one record ends
and another stards
- Sometimes output is lost

## Solution

Print to stderr.

## Changelog

- Panic handler in `LogPlugin` writes to stderr instead of stdin.
This commit is contained in:
Stepan Koltsov 2024-01-01 17:10:20 +00:00 committed by GitHub
parent 6bc2686a7a
commit 443b64a612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,7 +118,7 @@ impl Plugin for LogPlugin {
{
let old_handler = panic::take_hook();
panic::set_hook(Box::new(move |infos| {
println!("{}", tracing_error::SpanTrace::capture());
eprintln!("{}", tracing_error::SpanTrace::capture());
old_handler(infos);
}));
}