Skip to content

Scheduled methods do not log trace id when they throw #2085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MariellHoversholm-Paf opened this issue Dec 21, 2021 · 3 comments
Closed

Scheduled methods do not log trace id when they throw #2085

MariellHoversholm-Paf opened this issue Dec 21, 2021 · 3 comments
Labels
status: duplicate A duplicate of another issue

Comments

@MariellHoversholm-Paf
Copy link

Describe the bug
When throwing an exception in a @Scheduled method, Sleuth does not log a trace id.

Sample
The following code should do it:

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class SchedulingService {
  @Scheduled(fixedRate = 10_000L)
  public void scheduledException() {
    throw new RuntimeException("Scheduled exception");
  }
}

I have created a minimal project here: https://github.com/MariellHoversholm-Paf/sleuth-exception-no-traceid

There is a controller that also proves it does work as it logs the trace id through REST requests. See the test output here: https://github.com/MariellHoversholm-Paf/sleuth-exception-no-traceid/runs/4592123878?check_suite_focus=true#step:4:10835

This is done with the spring-cloud-dependencies version of 2021.0.0, which specifies Sleuth v3.1.0.

@MariellHoversholm-Paf
Copy link
Author

I noticed today when checking on the issue that I had made a private repository. I apologise for this; it has been publicised.

Happy new year's!

@jonatan-ivanov
Copy link
Member

jonatan-ivanov commented Jan 5, 2022

I'm closing this since it seems to be a duplicate of #1729 that was superseded by spring-projects/spring-framework#26533

Please let us know if this is a different issue and we should reopen.

@jonatan-ivanov jonatan-ivanov added status: duplicate A duplicate of another issue and removed waiting-for-triage labels Jan 5, 2022
@MariellHoversholm-Paf
Copy link
Author

I'm closing this since it seems to be a duplicate of #1729 that was superseded by spring-projects/spring-framework#26533

Please let us know if this is a different issue and we should reopen.

This is the same issue! Thanks a lot, I appreciate the time spent on triage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants