BTrace is a dynamic tracing and diagnostics tool for Java applications that attaches to live JVMs without requiring restart or recompilation.
BTrace solves the problem of diagnosing production Java applications when you cannot afford downtime or code changes. It works by dynamically instrumenting running JVMs through bytecode injection, allowing you to inject tracing code at runtime. The tool supports flexible probe types including method entry and exit, timing measurements, field access monitoring, and allocation tracking. Scripts are verified before execution to ensure they cannot crash the application, making it safe for production use.
BTrace suits teams that need to troubleshoot live systems without deployment cycles. It is particularly valuable when you need to trace method timings, track exceptions, or create custom probes on demand. The tool supports Java 8 through 25, though running against JVMs older than Java 17 is deprecated and will be unsupported in the next major release. Installation is straightforward through JBang, which requires no manual setup and handles version management automatically, or through traditional package managers and Docker.
The project maintains active development with regular updates to support new Java versions. The codebase is modular, with distinct components for runtime, core functionality, compilation, and agent instrumentation that can be tested independently. Documentation is comprehensive, covering quick reference guides, step-by-step tutorials, and extension development. The project provides multiple channels for community support including Slack and GitHub Issues, and accepts contributions with clear guidance on building from source and running the test suite.