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 8645159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:28:39+00:00 2026-06-12T12:28:39+00:00

I am learning Hibernate with Spring and am creating an application using the same

  • 0

I am learning Hibernate with Spring and am creating an application using the same with JSF 2.0. I am trying to configure the logging in my application but the log statements in my code do not seem to get sent to the output (console in my case).

I can see the Hibernate logging statements though 😐

Following is my project structure :

structure snapshot

And my log4j.properties :

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=debug, stdout

log4j.logger.org.hibernate=info
log4j.logger.org.springframework=warn
log4j.logger.org.hibernate.hql.ast.AST=info
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type=info
log4j.logger.org.hibernate.tool.hbm2ddl=warn
log4j.logger.org.hibernate.hql=info
log4j.logger.org.hibernate.cache=info
log4j.logger.org.hibernate.jdbc=info

And here’s the code for the context listener class:

import org.apache.log4j.Logger;
...
...
...

public class HibernateListener implements ServletContextListener 
{
   private static final String CFG_PATH = "/WEB-INF/hibernate.cfg.xml";

   private static final Logger LOGGER = Logger.getLogger(HibernateListener.class);

   @Override
   public void contextDestroyed(ServletContextEvent event) {
      HibernateUtil.getSessionFactory().close();
   }

   @Override
   public void contextInitialized(ServletContextEvent event) {
      URL configFile = null;
      try {
         configFile = event.getServletContext().getResource(CFG_PATH);
         HibernateUtil.buildSessionFactory(configFile);
         LOGGER.info("Context initialization successful");
         System.out.println("Context initialization successful");
      }
      catch (MalformedURLException e) {
         System.err.println("Could not load hibernate configuration file - " + configFile);
      }
   }
}

I can’t see the INFO statement nor the sysout…

  • 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-06-12T12:28:40+00:00Added an answer on June 12, 2026 at 12:28 pm

    It seems there WAS an issue with app server starting due to which the code never reached the LOG statement. Problem resolved after creating fresh instance of the application server…

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

Sidebar

Related Questions

I was learning how to make simple form validation using this tutorial: http://www.raistudies.com/spring/spring-mvc/form-validation-spring-mvc-3-hibernate-validator-jsr-303/ The
Learning Spring (3.1.0) and Hibernate (4.1.1). Just wondering what most developers do when handling
I've been using the following web development stack for a few years: java/spring/hibernate/mysql/jetty/wicket/jquery For
I am new to hibernate world, still learning it. I am trying to persist
Learning Spring MVC and Hibernate. import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity
I have been still learning Hibernate and I need to develope application which can
learning Hibernate and its really making me crazy i am trying to persist an
I have been learning java spring hibernate MVC for 3 months and got pretty
I am just learning Spring3 Validation with Hibernate. I have this class but I
Earlier I was using Netbeans,and it had all framework in it like struts ,spring,hibernate.As

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.