Skip to main content
In this lesson we’ll demonstrate how to enable verbose logging for a specific LangChain component so you can inspect what happens during execution. This technique is useful for debugging prompt formatting, understanding chain lifecycle events, and routing runtime information to custom handlers. We use an LLMChain with a ChatPromptTemplate that contains placeholders. First, here is the same program with verbose logging disabled.
Example output (non-verbose):

Enable verbose output for a chain

To print lifecycle messages and the fully formatted prompt (placeholders replaced), pass verbose=True when constructing the component:
Verbose console output (example):

What the verbose flag exposes

Verbose is a targeted debugging aid that reveals key runtime information for a component. It typically provides:

Use verbose selectively

Enable verbose=True only on the component(s) you need to inspect. This focused approach avoids overwhelming output from other parts of your system while giving clear visibility into the component under investigation.
Use verbose=True on only the components you need to inspect. Global debug or tracing options can produce a large amount of output; verbose is a targeted way to get helpful runtime visibility.

Example input data

Below is the input dictionary used in the examples (shown in a code block to avoid MDX parsing issues):

Routing verbose output with callbacks

If you prefer structured logging or tracing, LangChain callbacks let you capture verbose events and route them to custom handlers (for example, sending logs to a monitoring system, or collecting them in a structured store). Use callbacks to integrate verbose output with your observability stack. For more details, see:

Watch Video