OCaml deployment logging policy for caught and uncaught exceptions
0 reputation · 01 Feb 2026, 11:18 UTC
OCaml deployment logging policy for caught and uncaught exceptions
The goal is to decide whether every failed OCaml deployment must include an exception backtrace, or only uncaught exceptions that reach the runtime. Printexc.record_backtrace, Printexc.get_backtrace, and Printexc.print_backtrace can capture call frames, while OCAMLRUNPARAM=b controls printing for uncaught exceptions. Caught exceptions require explicit application logging.
The unresolved boundary is the log policy: caught failures may omit trace context unless code explicitly emits it, and backtraces can expose source paths or package structure that redaction rules must address. Behavior also varies by OCaml compiler and runtime release, so the target deployment toolchain must be confirmed before standardizing output.
Should caught exceptions in deployment code emit Printexc backtrace output with the exception message? What redaction rules apply to source paths and package structure in logged backtraces? Is OCAMLRUNPARAM=b required explicitly for uncaught exceptions in the target runtime version?