mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 17:39:22 +00:00
Merge pull request #13411 from moosepass/moosepass/fix-tracing-hook-order
Register tracing log hook before signal handling
This commit is contained in:
@@ -163,6 +163,12 @@ can be used and modified as necessary as a custom configuration.`
|
||||
return err
|
||||
}
|
||||
|
||||
// Register the tracing hook as soon as config is available. Later startup
|
||||
// steps may start goroutines that log, so avoid mutating hooks after hook
|
||||
// reads may have begun.
|
||||
tracingHook := tracing.NewLogrusHook(tracing.WithTraceIDField(config.Debug.LogTraceID))
|
||||
logrus.StandardLogger().AddHook(tracingHook)
|
||||
|
||||
// Make sure top-level directories are created early.
|
||||
if err := server.CreateTopLevelDirectories(config); err != nil {
|
||||
return err
|
||||
@@ -195,10 +201,6 @@ can be used and modified as necessary as a custom configuration.`
|
||||
log.G(ctx).WithError(w).Warn("cleanup temp mount")
|
||||
}
|
||||
|
||||
// Register logging hook for tracing
|
||||
tracingHook := tracing.NewLogrusHook(tracing.WithTraceIDField(config.Debug.LogTraceID))
|
||||
logrus.StandardLogger().AddHook(tracingHook)
|
||||
|
||||
log.G(ctx).WithFields(log.Fields{
|
||||
"version": version.Version,
|
||||
"revision": version.Revision,
|
||||
|
||||
Reference in New Issue
Block a user