- 
    Type:
Task
 - 
    Resolution: Unresolved
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: None
 - 
    Component/s: None
 - 
    None
 
- 
        Networking & Observability
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
The current story around logging within signal handlers is not very ergonomic from either the developer's or the debugger's perspective. There isn't a good way to produce log messages that leverage the strengths of structured logging. The logging that occurs in signal handlers has to use malloc-free tooling to avoid allocating memory during signal handlers, which is dangerous as documented in SERVER-82658. We don't have any support on top of that malloc-free tooling to build JSON objects and emit them as fields. Rather, we only have the coarse-grained support for setting the message field as a string. This results in awkward constructions, like emitting a JSON-like object, stringified, in the message field.
Revisit the logging support in the signal handling code, and see if we can add support for emitting log statements with structured contents.
- is related to
 - 
                    
SERVER-82658 Log system will attempt to allocate inside of signal handler
-         
 - Open
 
 -         
 - 
                    
SERVER-101121 Make invariant/signal handler logging output valid json
-         
 - Closed
 
 -         
 
- related to
 - 
                    
SERVER-106512 Investigate ScopedDebugInfo's inability to be pretty-printed
-         
 - In Code Review
 
 -