Skip to content

Using LogTracer with a tracing subscriber #2875

Answered by criccomini
jwodder asked this question in Q&A
Discussion options

You must be logged in to vote

Figured this out. Apparently if you use the default features for tracing_subscriber, it enables tracing-log, which causes SubscriberBuilder.init() to register with the log global logger. This prevents you from using the subscriber along side tracing_log. To fix this, you need to disable the default features for tracing_subscriber:

tracing-subscriber = { version = "0.3", default-features = false }

Here's a look at a diff that works:

diff --git a/Cargo.lock b/Cargo.lock
index 06ed52f..fd19c97 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3195,6 +3195,7 @@ dependencies = [
  "tokio-test",
  "tokio-util",
  "tracing",
+ "tracing-log",
  "tracing-subscriber",
  "ulid",
  "uuid",
diff --git a/C…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@criccomini
Comment options

Answer selected by jwodder
@criccomini
Comment options

@criccomini
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants