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

  • SEARCH
  • Home
  • 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 6252317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:46:30+00:00 2026-05-24T13:46:30+00:00

I am using Spring & Hibernate in my application and I want to set

  • 0

I am using Spring & Hibernate in my application and I want to set up two different log files – one main log file all the non-sql logging and another file for writing sql queries. This is my log4j.properties file.. But while the sql log file is working as expected..the issue is that the main log file also contains sql queries.. What changes should I make here to to stop writing sql queries to main log file..

#application log properties
log4j.appender.rollingFile = org.apache.log4j.DailyRollingFileAppender
log4j.appender.rollingFile.File = C:\\myapp\\logs\\app.log
log4j.appender.rollingFile.Threshold = TRACE
log4j.appender.rollingFile.DatePattern = '.'yyyy-MM-dd
log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout 
log4j.appender.rollingFile.layout.ConversionPattern=%d %5p [%C:%M:%L] - %m%n
log4j.rootLogger = ERROR, rollingFile

#hibernate properties
log4j.appender.file = org.apache.log4j.DailyRollingFileAppender 
log4j.appender.file.File = C:\\myapp\\logs\\sql.log
log4j.appender.file.Threshold = TRACE
log4j.appender.file.DatePattern = '.'yyyy-MM-dd
log4j.appender.file.layout = org.apache.log4j.PatternLayout 
log4j.appender.file.layout.ConversionPattern=%d %5p [%C:%M:%L] - %m%n
log4j.logger.jdbc.sqltiming = DEBUG, 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. Editorial Team
    Editorial Team
    2026-05-24T13:46:31+00:00Added an answer on May 24, 2026 at 1:46 pm

    This is the additivity behaviour of the appenders in log4j .

    Each enabled logging request for a given logger will be
    forwarded to all the appenders in that logger as well as the appenders
    higher in the hierarchy.

    Just set the additivity for the logger jdbc.sqltiming to false and its log messages will not be propagated to its parent loggers’ appenders (i.e. app.log)

    log4j.additivity.jdbc.sqltiming = false
    

    References:

    See the section Appenders and Layouts for more information about Appender Additivity

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

Sidebar

Related Questions

We're using Spring 2.5.4/Hibernate 3.2/Websphere Application Server 6.1.0.17. We've deployed the application on an
We're using Spring/Hibernate on a Websphere Application Server for AIX. On my Windows machine,
I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my
In a Java application stack with Spring & Hibernate (JPA) in the Data Access
I am using hibernate, spring, struts framework for my application. In my application, each
I am using Spring Forms for my web application. For nested properties, the form
I am using Spring MVC to build my web application, and I have a
A project I am working on uses Spring 2.5 & JPA with Hibernate as
I am using Spring+Hibernate for an operation which requires creating and updating literally hundreds
I'm using Hibernate for all CRUD operations in my project. It doesn't work for

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.