diff --git a/cmd/root.go b/cmd/root.go index 848a91f21c5..2b43371d937 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -352,6 +352,9 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str if input.jsonLogger { log.SetFormatter(&log.JSONFormatter{}) } + if log.IsLevelEnabled(log.DebugLevel) { + log.SetReportCaller(true) + } if ok, _ := cmd.Flags().GetBool("bug-report"); ok { return bugReport(ctx, cmd.Version) diff --git a/pkg/runner/logger.go b/pkg/runner/logger.go index a788f680e3a..8491befa610 100644 --- a/pkg/runner/logger.go +++ b/pkg/runner/logger.go @@ -96,6 +96,8 @@ func WithJobLogger(ctx context.Context, jobID string, jobName string, config *Co logger.SetFormatter(formatter) } + // If the main logger is reporting caller, this inner one should too + logger.SetReportCaller(logrus.StandardLogger().ReportCaller) logger.SetFormatter(&maskedFormatter{ Formatter: logger.Formatter, masker: valueMasker(config.InsecureSecrets, config.Secrets),