tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dilip Shah" <dilipvs...@hotmail.com>
Subject Re: catalina.out file is growing very rapidly! How to prevent Hibernate's INFO and DEBUG statements from getting added to catalina.out file?
Date Thu, 19 Apr 2012 22:57:18 GMT
Hi Konstantin,

I checked all the jar files I added to common/lib and none of them have 
log4j.properties file at the root location.

I get your suggestion on putting application specific jar files in the 
application's WEB-INF/lib folder... I'll go ahead and take care of it.

The application's web.xml:
====================
<web-app
	id="WebApp_ID"
	version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
	http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	>

	<display-name>Smart Cloud Learning</display-name>
	<description>Smart Cloud Learning Application</description>

	<!-- The front controller of this Spring Web application,
		responsible for handling all application requests -->
	<servlet>
		<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>/WEB-INF/applicationContext.xml</param-value>
		</init-param>
	</servlet>

	<!-- Map all spring/* requests to the DispatcherServlet for handling -->
	<servlet-mapping>
		<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
		<url-pattern>/rest/*</url-pattern>
	</servlet-mapping>

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
</web-app>


applicationContext.xml:
=================
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
		http://www.springframework.org/schema/tx
		http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
        ">

	<context:component-scan base-package="com.knownomy.scl">
	     <context:include-filter type="aspectj" expression="com.knownomy.scl.*" 
/>
	</context:component-scan>

	<mvc:annotation-driven />

	<!-- START Load application properties -->
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property 
name="location"><value>WEB-INF/application.properties</value></property>
	</bean>

	<!-- Data source configuration -->
	<bean
		id="dataSource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property
			name="driverClass"
			value="${jdbc.driverClassName}"/>
		<property
			name="jdbcUrl"
			value="${jdbc.url}"/>
		<property
			name="user"
			value="${jdbc.username}"/>
		<property
			name="password"
			value="${jdbc.password}"/>
		<property
			name="minPoolSize">
			<value>${hibernate.c3p0.min_size}</value>
			</property>
		<property
			name="maxPoolSize">
			<value>${hibernate.c3p0.max_size}</value>
			</property>
		<property
			name="acquireRetryAttempts">
			<value>10</value>
			</property>
		<property
			name="acquireIncrement">
			<value>${hibernate.c3p0.acquire_increment}</value>
			</property>
		<property
			name="idleConnectionTestPeriod">
			<value>${hibernate.c3p0.idle_test_period}</value>
			</property>
		<property
			name="maxIdleTime">
			<value>${hibernate.c3p0.timeout}</value>
			</property>
		<property
			name="preferredTestQuery">
			<value>SELECT 1</value>
			</property>
		<property
			name="testConnectionOnCheckin">
			<value>false</value>
			</property>
	</bean>

	<!-- START HIBERNATE CONFIG -->
	<!-- Configure SessionFactory -->
	<bean
		id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property
			name="dataSource"
			ref="dataSource" />
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
				<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
				<prop 
key="hibernate.transaction.factory_class">${hibernate.transaction.factory_class}</prop>
				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
				<prop key="hibernate.c3p0.min_size">${hibernate.c3p0.min_size}</prop>
				<prop key="hibernate.c3p0.max_size">${hibernate.c3p0.max_size}</prop>
				<prop 
key="hibernate.c3p0.acquire_increment">${hibernate.c3p0.acquire_increment}</prop>
				<prop key="hibernate.c3p0.timeout">${hibernate.c3p0.timeout}</prop>
				<prop 
key="hibernate.c3p0.max_statements">${hibernate.c3p0.max_statements}</prop>
				<prop 
key="hibernate.c3p0.idle_test_period">${hibernate.c3p0.idle_test_period}</prop>
			</props>
		</property>

		<property name="annotatedClasses">
			<list>
				<value>com.knownomy.scl.appcommon.domain.Language</value>
				<value>com.knownomy.scl.appcommon.domain.Syllabus</value>
				<value>com.knownomy.scl.appcommon.domain.Country</value>
				<value>com.knownomy.scl.appcommon.domain.State</value>
				<value>com.knownomy.scl.appcommon.domain.Grade</value>
				<value>com.knownomy.scl.appcommon.domain.Subject</value>
				<value>com.knownomy.scl.appcommon.domain.EmbeddedImage</value>
				<value>com.knownomy.scl.appcommon.domain.PageSetup</value>

			</list>
		</property>

	</bean>

	<!-- enable the configuration of transactional behavior based on 
annotations -->
	<tx:annotation-driven transaction-manager="txManager"/>

	<bean id="txManager" 
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory"><ref local="sessionFactory"/></property>
	</bean>

	<bean 
class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>
	<!-- END HIBERNATE CONFIG -->
</beans>


application.properties:
=================
#  Application Properties
path.webinf=webapps/SmartCloudLearningMobi/WEB-INF
# JDBC Connection information
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/databasename?useUnicode=true&characterEncoding=UTF8
jdbc.username=root
jdbc.password=mypassword
###hibernate
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.c3p0.min_size=1
hibernate.c3p0.max_size=25
hibernate.c3p0.acquire_increment=5
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50
hibernate.c3p0.idle_test_period=3600

Thanks,

Dilip

--------------------------------------------------
From: "Konstantin Kolinko" <knst.kolinko@gmail.com>
Sent: Thursday, April 19, 2012 3:21 PM
To: "Tomcat Users List" <users@tomcat.apache.org>
Subject: Re: catalina.out file is growing very rapidly! How to prevent 
Hibernate's INFO and DEBUG statements from getting added to catalina.out 
file?

> 2012/4/20 Dilip Shah <dilipvshah@hotmail.com>:
>> Hi Konstantin,
>>
>> Thanks for the reply!
>>
>> To answer your questions...
>> * Tomcat version info:
>> Server version: Apache Tomcat/5.5.28
>> Server built:   Jul 24 2009 01:33:09
>> Server number:  5.5.28.0
>> OS Name:        Linux
>> OS Version:     2.6.18-53.el5
>> Architecture:   i386
>> JVM Version:    1.6.0_23-ea-b01
>>
>> * Since I'm configuring the application's logging via log4j.properties, I
>> can safely assume that logging is done via Log4j and not JULI, right?
>> Your statement about log formatting also seems to suggest the same. Let 
>> me
>> know if I interpreted your statement incorrectly.
>
> OK.
> The problem is that something configured logging for you  (e.g. by
> providing its own copy of configuration file).
>
> One example of such bad library is mentioned here:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=52011
>
> IIRC Log4j supports 2 configuration file names: log4j.properties and
> log4j.xml. See Log4J documentation for details.
>
> Search whether some of jars that you added has such a file. If they
> are in commons/lib it means that Tomcat sees them.
>
>>
>> * The changes I made to the application:
>> - I implemented Spring view controller (for the first time) and in the
>> process added @Autowired, @JsonIgnore through the code
>> - in the process of getting jSON output to the client, I added the 
>> following
>> jar files to common/lib
>
> Adding them to common/lib is a bad idea (a way to jar hell).
>
> You'd better put them into your app's WEB-INF/lib.
>
>> aspectjtools-1.5.4.jar
>> bval-core-0.3-incubating.jar
>> hibernate-validator-4.1.0.Final.jar
>> jackson-core-asl-1.6.4.jar
>> jackson-mapper-asl-1.6.4.jar
>> joda-time-1.6.2.jar
>> joda-time-jsptags-1.0.2.jar
>> jstl-1.2.jar
>> validation-api-1.0.0.GA.jar
>>
>> I suspect packages in one or more of these jar files is generating these
>> INFO and DEBUG log entries in catalina.out
>>
>> * The application's log4j.properties file is in the application's
>> WEB-INF/classes folder
>>
>
> What is in your configuration file?
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message