Mark,

Thanks for the comments and suggestions... very much appreciated.

About your comment '3. log4j.properties part 2'...
I do have application specific log4j.properties in the application's WEB-INF/classes/ folder and I'm happy with the logging that's taking place in the specified log file in ${catalina.base}/logs/ The problem is that there seem to be one / several jar files that I use in my application that are adding vast number of INFO and DEBUG statements in catalina.out I'm unable to determine how this is happening and how to prevent it. These log entries have patterns that are completely different from the one I've defined in my application's log4j.properties

Example of statement that I log from my application from the application's log file ${catalina.base}/logs/SmartCloudLearningMobi.log [ INFO] 2012-04-20 03:17:25 (ResourceServiceImpl.java:getResourceTypes:210) - Returning the following resource types:
Video
Audio
Image
Document

Whereas example of the 'mysterious' log statements from ${catalina.base}/logs/catalina.out 01:52:46.050 [main] DEBUG org.hibernate.cfg.Ejb3Column - Binding column: Ejb3Column{table=org.hibernate.mapping.Table(organizationSubject), mappingColumn=subject, insertable=true, updatable=true, unique=false} 01:52:46.050 [main] DEBUG o.h.cfg.annotations.PropertyBinder - Building property subject 01:52:46.051 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.knownomy.scl.organization.domain.OrganizationRelationship 01:52:46.051 [main] DEBUG org.hibernate.cfg.Ejb3Column - Binding column: Ejb3DiscriminatorColumn{logicalColumnName'DTYPE', discriminatorTypeName='string'}

Dilip

--------------------------------------------------
From: "Mark Eggers" <its_toas...@yahoo.com>
Sent: Friday, April 20, 2012 4:00 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?

----- Original Message -----

From: Konstantin Kolinko <knst.koli...@gmail.com>
To: Tomcat Users List <users@tomcat.apache.org>
Cc:
Sent: Friday, April 20, 2012 1:30 PM
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/21 Dilip Shah <dilipvs...@hotmail.com>:
 Konstantin and Chris,

 Very much appreciate your observations and suggestions. To start with,
I'm
going to streamline the jar files in common/lib and WEB-INF/lib. If that
 still doesn't help, I'll bite the bullet and upgrade to Tomcat 7.
Any
suggested reading on delta between 5.5 and 7.x, steps to follow, what to
 look for / be careful of when upgrading from Tomcat 5.5 to 7?


http://tomcat.apache.org/migration.html
http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html

Best regards,
Konstantin Kolinko


As always, late in commenting.

I'm going to start from the top down, and amplify what Christopher
and Konstantin have already said.

A. Tomcat issues

1. Tomcat

Upgrade at least to 6.0.35 (latest 6.0 when this was written) or
preferably to 7.0.27 (lastest 7.0 when this was written).

Read and follow the migration guides. Do NOT just blindly copy
server.xml configurations.

http://tomcat.apache.org/migration.html


2. JAR files

Web applications are designed by specification to be independent. This
means unless Tomcat is using the JARs (for example, Tomcat-controlled
connection pools), the JARs should NOT be in:

Tomcat 5: commons/lib
Tomcat 6: lib
Tomcat 7: lib

3. Configuration files

Log4j uses either log4j.properties or log4j.xml (preferred). This
should NOT be in:

Tomcat 5: commons/classes
Tomcat 6: ??
Tomcat 7: ??


B. Application Issues

1. Pooling

Your application manages database pooling with C3P0. This is
not recommended for production. Look at using JNDI with Hibernate. An
example on how to do this with Tomcat can be found here:

http://wiki.apache.org/tomcat/TomcatHibernate

It's a bit dated, but it should still work. If not, I will update it.

2. log4j.properties

You should really look at using log4j.xml. There are at least two
advantages in doing so.

a. In the battle of log4j.properties versus log4j.xml, log4j.xml wins

This means that if some JAR file in your project has a
log4j.properties file, your log4j.xml file will take precedence.

b. Modern editor support for DTD - based editing

Emacs, jEdit, NetBeans, Eclipse, and IDEA IntelliJ all support DTD -
based editing. This eliminates lots of mistakes when configuring
log4j.

3. log4j.properties part 2

You should really look at writing your application log files to a
different file than Tomcat log files. Your operations people will
thank you for it.

This is quite easy, and you have most of the boilerplate already.
Just change to ${catalina.base}/logs/app-name.log for your log file.
If your system already does log rotation based on file name
extension, then this should fit right in.

4. log4j.properties part 3

If you are set on using log4j.properties, here is an example
log4j.properties file that I've used to keep logging down to a
minimum. Your mileage may vary.

### direct messages to file hibernate.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=${catalina.home}/logs/app-name.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'warn' to
### 'info' or 'debug'
###

log4j.rootLogger=warn, file

log4j.logger.org.hibernate=warn
# log4j.logger.org.hibernate=debug

### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
# log4j.logger.org.hibernate.type=info
# log4j.logger.org.hibernate.type=debug

### log schema export/update ###
# log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log transaction activity
#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace

### Spring Framework logging
log4j.logger.org.springframework=warn

. . . . just my two cents.
/mde/


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



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

Reply via email to