> For the complete documentation index, see [llms.txt](https://coldbox-orm.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coldbox-orm.ortusbooks.com/v5.x/advanced/hibernate-logging.md).

# Hibernate Logging

Configuring and tuning Hibernate logging

Logs are your best friend when it comes to Hibernate and its plethora of obscure error codes and situations. Hibernate is incredible until it's not. In cborm 6 all ORM logging comes from the `bx-orm` module and the BoxLang logging system.

![](https://content.gitbook.com/content/cXmAaUKqyl0wbP6oiv6J/blobs/FI5okERQwvEebn5DLE32/image.png)

{% hint style="warning" %}
**Changed in cborm 6**: the `ORMUtilSupport().setupHibernateLogging()` helper and the engine-specific (Lucee and Adobe log4j) setups are gone. Use the settings below.
{% endhint %}

## The ORM Log

bx-orm and Hibernate write their log statements to the `orm.log` file in the BoxLang runtime `logs/` directory (`${boxlang-home}/logs/orm.log`). Raise or lower the level of the `orm` logger in your BoxLang runtime configuration (`boxlang.json`) to see more or less detail. See the [BoxLang logging documentation](https://boxlang.ortusbooks.com/getting-started/configuration/logging) for how loggers are configured.

## Logging SQL

Turn on `logSQL` in your ORM settings to log every SQL statement Hibernate runs:

{% code title="Application.bx" %}

```javascript
this.ormSettings = {
    // ...
    logSQL : true
};
```

{% endcode %}

The statements are written to the same `orm.log` file.

## SQL of a Single Query

You do not need global logging to see what one criteria query runs:

```javascript
var c = userService
    .newCriteria()
    .isEq( "isActive", true )
    .like( "lastName", "M%" );

// The SQL the query will run, without running it
writeDump( c.getSQL() );

// Or record the SQL of the query as you build it
c.startSqlLog()
    .logSQL( "active users" );
writeDump( c.getSqlLog() );
```

See [Help! I'm Not Getting the Result I Expected!](/v5.x/criteria-queries/help-im-not-getting-the-result-i-expected.md) for more debugging tips.

## ORM Diagnostics

`ormDiagnostics()` returns the ORM state of the current application: status, the last startup error, entities per datasource, warnings and key settings. It never throws, so it is safe to call from a debugging page:

```javascript
writeDump( ormDiagnostics() );
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://coldbox-orm.ortusbooks.com/v5.x/advanced/hibernate-logging.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
