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

# Logging

## How can I configure/acquire Hibernate logging in the Ortus ORM Extension?

The Ortus ORM Extension reconfigures all Hibernate logging output on startup to log `ERROR`-level events to the server console.

## How can I configure/acquire Hibernate logging in the Lucee Hibernate Extension?

This depends on the version of Lucee you are running - specifically, on whether you're on Log4J 2 or not.

### Lucee versions running Log4J 1.x

Lucee versions containing the older log4j 1.x can use this code to set a custom logging level and redirect the Hibernate logs to the server console:

```
void function setupHibernateLogging( level = "WARN" ){
	var Logger       = createObject( "java", "org.apache.log4j.Logger" );
	var log4jLevel   = createObject( "java", "org.apache.log4j.Level" );
	var hibernateLog = Logger.getLogger( "org.hibernate" );
	// set a custom log level
	hibernateLog.setLevel( log4jLevel[ arguments.level ] );

	/**
	 * Redirect all Hibernate logs to system.out
	 */
	if ( listFindNoCase( "Lucee", server.coldfusion.productname ) ) {
		var printWriter     = getPageContext().getConfig().getOutWriter();
		var layout          = createObject( "java", "lucee.commons.io.log.log4j.layout.ClassicLayout" );
		var consoleAppender = createObject( "java", "lucee.commons.io.log.log4j.appender.ConsoleAppender" ).init(
			printWriter,
			layout
		);
		hibernateLog.addAppender( consoleAppender );
		writeDump( var = "** Lucee Hibernate Logging Redirected", output = "console" );
	}
}
```

### Lucee versions running Log4J 2.x

For versions of Lucee running log4j 2.x, the above workaround does not apply. If you are interested in tweaking the Hibernate logging level in the Lucee Hibernate extension, I would suggest [sponsoring this feature](https://www.ortussolutions.com/products/orm-extension#support) and future users can benefit from the shared knowledge.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://orm-extension.ortusbooks.com/getting-started/configuration/logging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
