A computer-implemented method for collecting trace streams in application code, instruments the application code to detect an
application context. The
application context includes static and dynamic attributes. The method also includes steps of: achieving the
application context a first time, collecting static attributes of the application context, determining a name for the application
context based on static attributes, sending the application context name to the trace subsystem and receiving a trace
stream handle in return, storing the trace-
stream handle and marking the application context such that achieving the same application context later in the program execution is recognizable, receiving the application context name by the trace subsystem, registering the context name in the trace subsystem, returning from the trace subsystem a unique trace
stream handle for each unique application context, achieving the instrumented application context after the first time including access to stored trace stream handle, sending dynamic information and the trace stream handle of the application context to the trace subsystem, sending the application context names and associated sequence of dynamic information to
trace analysis tools, and receiving the application context names and associated sequence of dynamic information in a
trace analysis tool.