You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Spring Boot 3.2.4 with Jetty (spring boot supplied version) in a 'standard' web mvc project.
When activating the virtual threads feature through configuration within application.yml the logging of the thread names disappears. I am using the default log pattern supplied by spring boot.
I suspect it is related to JettyVirtualThreadsWebServerFactoryCustomizer only using threadPool.setVirtualThreadsExecutor(VirtualThreads.getDefaultVirtualThreadsExecutor());.
The Jetty team has provided another factory method, making it possible to supply a name prefix for virtual threads: jetty/jetty.project#11353 (comment)
Looking into the codebase of the supplied Jetty, this new factory method seems to be available to Spring Boot already.
My suggestion would be to use this new factory method and assign either a default or a configurable virtual thread name prefix from the Jetty auto configuration (or both 😬).
At least the logged thread name should not be empty when using virtual threads.
The text was updated successfully, but these errors were encountered:
Spring Boot typically hard-codes a thread name prefix (for example, see #39748) but does not make the prefix configurable. I think that should be sufficient here also.
@holgerstolzenberg This one has been marked as a bug and it has a 3.2.x target. That means it's something we'd like to fix in a 3.2 release if possible.
mhalbritter
changed the title
JettyVirtualThreadsWebServerFactoryCustomizer should use named virtual threads for better logging
Jetty support doesn't set virtual thread name
Apr 4, 2024
I am using Spring Boot
3.2.4
with Jetty (spring boot supplied version) in a 'standard' web mvc project.When activating the virtual threads feature through configuration within
application.yml
the logging of the thread names disappears. I am using the default log pattern supplied by spring boot.I suspect it is related to
JettyVirtualThreadsWebServerFactoryCustomizer
only usingthreadPool.setVirtualThreadsExecutor(VirtualThreads.getDefaultVirtualThreadsExecutor());
.The Jetty team has provided another factory method, making it possible to supply a name prefix for virtual threads:
jetty/jetty.project#11353 (comment)
Looking into the codebase of the supplied Jetty, this new factory method seems to be available to Spring Boot already.
My suggestion would be to use this new factory method and assign either a default or a configurable virtual thread name prefix from the Jetty auto configuration (or both 😬).
At least the logged thread name should not be empty when using virtual threads.
The text was updated successfully, but these errors were encountered: