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

# Logging

Where bx-orm, SQL and Hibernate logs go, and how to turn them on

There are several categories of logs generated during normal use of a bx-orm application:

1. `bx-orm` logs
2. SQL logs
3. Hibernate logs
4. Startup Metrics

## bx-orm logs

Logging statements generated from bx-orm itself will be output to the `orm.log` file located in the boxlang runtime `logs/` directory.

This log file may look something like the below when DEBUG mode is enabled:

```
[2025-04-25T09:50:34,965] [Test worker] [DEBUG] [ORM] beforeApplicationListenerLoad fired; checking for ORM configuration 
[2025-04-25T09:50:34,972] [Test worker] [DEBUG] [ORM] ORMEnabled, starting up ORM app for [myApp] 
[2025-04-25T09:50:34,979] [Test worker] [DEBUG] [ORM] ORMApp created for application: [myapp_1428735748] 
[2025-04-25T09:50:35,001] [Test worker] [DEBUG] [ORM] Found more than 20 entities; parallelizing metadata introspection 
[2025-04-25T09:50:35,006] [Test worker] [DEBUG] [ORM] Loading metadata for class /app/models/cms/Author.bx 
[2025-04-25T09:50:35,007] [Test worker] [DEBUG] [ORM] Parsing class file: [/app/models/cms/Author.bx] 
...
```

For more information on configuring loggers, see the [Boxlang Logging](https://boxlang.ortusbooks.com/getting-started/configuration/logging) documentation.

## SQL Logs

bx-orm has the ability to log every SQL statement generated from ORM code. For example, firing `entityDelete( myEntity )` will generate a `DELETE` SQL statement for deleting the entity (table row) in question from the entity table.

A quick example might be this log, generated after firing `entityNew( "Manufacturer", properties )`:

```
[2025-04-25T09:50:46,264] [Test worker] [DEBUG] [org.hibernate.SQL] 
    /* insert Manufacturer
        */ insert 
        into
            manufacturers
            (name, address, id) 
        values
            (?, ?, ?) 
```

To enable this behavior, set `this.ormSettings.logSQL` to `true` in your `Application.bx`:

```js
this.ormSettings={
	"logSQL" : "true"
	// ...
}
```

These SQL statements will also log to the `orm.log` file located in `${boxlang-home}/logs`.

## Hibernate-native logs

Hibernate-native logging statements will also be captured in the `orm.log` file located in `${boxlang-home}/logs`.

## Startup Metrics

In debug mode, bx-orm will log the time taken for each step of the startup process, including entity discovery, metadata parsing, XML mapping generation, and SessionFactory building. Here are some example log entries:

```bash
ORM startup metric - entity file discovery: 42ms (187 candidate files found)
ORM startup metric - entity metadata parsing: 310ms (23 persistent entities found, sequential mode)
ORM startup metric - XML mapping generation: 88ms (23 mapping files generated)
ORM startup metric - total entity discovery, parsing and meta collection: 455ms
ORM startup metric - Hibernate SessionFactory build time [myDatasource]: 1243ms
ORM startup metric - Hibernate SessionFactory build time [defaultDatasource]: 987ms
```

The mapping line says `generated` when bx-orm generates the mappings, or `pre-generated` when `generateMappings` is `false` and existing `.orm.xml` files are read. The `total entity discovery, parsing and meta collection` line is the sum of the steps before Hibernate starts.

{% hint style="info" %}
Only available in bx-orm\@1.6.4 and later.
{% endhint %}


---

# 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://bxorm.ortusbooks.com/bxorm-2.x/getting-started/configuration/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.
