I need to be able to access the currently executing web request in Tornado deep within my application without passing it down through all of my methods. When the request is first received I want to assign a trace id to it and then every time a message gets logged I want to include it in the logging information.
Is there some global information somewhere that I can use in Tornado to identify the current request that's being processed?
Thanks!
Tornado's StackContext is the way to do this.
Here's an example: https://gist.github.com/simon-weber/7755289.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With