Getting the instance of Hibernate's Logger

This may very well be more directed toward the Railo group, but with the testing I’ve done I land at starting with CommandBox, so here goes :slight_smile:

I am trying to get the Logger instance that Hibernate uses so I can add additional appenders to it. In ACF, this is pretty straight-forward:

createObject("java", "org.apache.log4j.Logger").getLogger("org.hibernate.SQL");

The instance of Railo in CommandBox doesn’t appear to have this Logger available. I looked at the log4j.properties file which consists of the following:

`
###--------------- Hibernate Log Settings ------

Set Hibernate log

log4j.logger.org.hibernate=ERROR, HIBERNATECONSOLE

log just the SQL

#log4j.logger.org.hibernate.SQL=DEBUG, HIBERNATECONSOLE
#log4j.additivity.org.hibernate.SQL=false

Also log the parameter binding to the prepared statements.

#log4j.logger.org.hibernate.type=DEBUG

log schema export/update

log4j.logger.org.hibernate.tool.hbm2ddl=DEBUG, HIBERNATECONSOLE

log cache activity

log4j.logger.org.hibernate.cache=ERROR, HIBERNATECONSOLE

HibernateConsole is set to be a ColsoleAppender for Hibernate message using a PatternLayout.

log4j.appender.HIBERNATECONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.HIBERNATECONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.HIBERNATECONSOLE.layout.ConversionPattern=%d{MM/dd HH:mm:ss} [%t] HIBERNATE %-5p - %m%n%n

I ended up resolving this by including the configuration file prior to trying to get all the loggers. So, as you would expect, this was at the Railo level (I wasn’t sure if CommandBox did anything special since LogBox was included). Here’s the post for reference: https://groups.google.com/d/msg/lucee/bCGUDx2imZk/A-1C6YsEr1wJ