Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 120139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:45:50+00:00 2026-05-11T03:45:50+00:00

I haven’t been able to find any documentation on how to configure Hibernate’s logging

  • 0

I haven’t been able to find any documentation on how to configure Hibernate’s logging using the XML style configuration file for Log4j.

Is this even possible or do I have use a properties style configuration file to control Hibernate’s logging?

If anyone has any information or links to documentation it would appreciated.

EDIT:
Just to clarify, I am looking for an example of the actual XML syntax to control Hibernate.

EDIT2:
Here is what I have in my XML config file.

<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE log4j:configuration SYSTEM 'log4j.dtd'>  <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>     <appender name='console' class='org.apache.log4j.ConsoleAppender'>         <param name='Threshold' value='info'/>         <param name='Target' value='System.out'/>         <layout class='org.apache.log4j.PatternLayout'>             <param name='ConversionPattern' value='%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n'/>         </layout>     </appender>     <appender name='rolling-file' class='org.apache.log4j.RollingFileAppender'>         <param name='file' value='Program-Name.log'/>         <param name='MaxFileSize' value='1000KB'/>     <!-- Keep one backup file -->         <param name='MaxBackupIndex' value='4'/>         <layout class='org.apache.log4j.PatternLayout'>             <param name='ConversionPattern' value='%d [%t] %-5p %l - %m%n'/>         </layout>     </appender>      <root>         <priority value ='debug' />         <appender-ref ref='console' />         <appender-ref ref='rolling-file' />     </root> </log4j:configuration> 

Logging works fine but I am looking for a way to step down and control the hibernate logging in way that separate from my application level logging, as it currently is flooding my logs. I have found examples of using the preference file to do this, I was just wondering how I can do this in a XML file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:45:51+00:00Added an answer on May 11, 2026 at 3:45 am

    From http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-logging

    Here’s the list of logger categories:

    Category                    Function  org.hibernate.SQL           Log all SQL DML statements as they are executed org.hibernate.type          Log all JDBC parameters org.hibernate.tool.hbm2ddl  Log all SQL DDL statements as they are executed org.hibernate.pretty        Log the state of all entities (max 20 entities) associated with the session at flush time org.hibernate.cache         Log all second-level cache activity org.hibernate.transaction   Log transaction related activity org.hibernate.jdbc          Log all JDBC resource acquisition org.hibernate.hql.ast.AST   Log HQL and SQL ASTs during query parsing org.hibernate.secure        Log all JAAS authorization requests org.hibernate               Log everything (a lot of information, but very useful for troubleshooting)  

    Formatted for pasting into a log4j XML configuration file:

    <!-- Log all SQL DML statements as they are executed --> <Logger name='org.hibernate.SQL' level='debug' /> <!-- Log all JDBC parameters --> <Logger name='org.hibernate.type' level='debug' /> <!-- Log all SQL DDL statements as they are executed --> <Logger name='org.hibernate.tool.hbm2ddl' level='debug' /> <!-- Log the state of all entities (max 20 entities) associated with the session at flush time --> <Logger name='org.hibernate.pretty' level='debug' /> <!-- Log all second-level cache activity --> <Logger name='org.hibernate.cache' level='debug' /> <!-- Log transaction related activity --> <Logger name='org.hibernate.transaction' level='debug' /> <!-- Log all JDBC resource acquisition --> <Logger name='org.hibernate.jdbc' level='debug' /> <!-- Log HQL and SQL ASTs during query parsing --> <Logger name='org.hibernate.hql.ast.AST' level='debug' /> <!-- Log all JAAS authorization requests --> <Logger name='org.hibernate.secure' level='debug' /> <!-- Log everything (a lot of information, but very useful for troubleshooting) --> <Logger name='org.hibernate' level='debug' /> 

    NB: Most of the loggers use the DEBUG level, however org.hibernate.type uses TRACE. In previous versions of Hibernate org.hibernate.type also used DEBUG, but as of Hibernate 3 you must set the level to TRACE (or ALL) in order to see the JDBC parameter binding logging.

    And a category is specified as such:

    <logger name='org.hibernate'>     <level value='ALL' />     <appender-ref ref='FILE'/> </logger> 

    It must be placed before the root element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I haven't been able to find any useful resources online on how to do
I haven't been able to find documentation that talk about how create.js.erb and destroy.js.erb
I haven't been able to find a very clear description of what's going on
I haven't been able to find a tutorial on how to properly setup a
I haven't been able to find much about this but am I the only
I haven't been able to find authorative explanations, microformats or guidelines for the following,
Haven't been able to find this one out. How are Bitmaps stored in memory
I haven't been able to get this working and all of the sample code
Haven't been able to figure this out yet.. I've seen a few answers around
I haven't been able to figure out how to use strings from resource files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.