-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: suppress initialization logging
PostPosted: Mon Jan 10, 2005 3:32 am 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
I have tried tweaking the log4j properties everyway I know how and I can't get the initialization from logging on hibernate startup.

I am running inside the springframework if it makes a difference.

It is the biggest issue when running junit tests. Lots of extra logs that I don't really want to see.

When starting up I get about 30 pages of the following (Shortened for forum!) I have tried everything I know and can't get this logging to turn off. Is it 'system.out'? log4j properties don't seem to have any control.

C:\_dev_>ant test -Dtestcase=InventoryController
Buildfile: build.xml

compile:

test:
[junit] - Loading XML bean definitions from resource [/WEB-INF/inv-servlet.xml] of ServletContext
[junit] - Loading XML bean definitions from resource [/WEB-INF/applicationContext-hibernate.xml] of ServletContext
[junit] - Overriding bean definition for bean 'messageSource': replacing [Root bean with class [org.springframework.context.support.ResourceBundleMessageSou
rce] defined in resource [/WEB-INF/inv-servlet.xml] of ServletContext] with [Root bean with class [org.springframework.context.support.ResourceBundleMessageSour
ce] defined in resource [/WEB-INF/applicationContext-hibernate.xml] of ServletContext]
[junit] - Bean factory for application context [Root XmlWebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory definin
g beans ... ,HSQLDataSource,hibernateOracleSessionFactory,
hibernateHSQLSessionFactory,hibernateTransactionManager,orderDao]; Root of BeanFactory hierarchy
[junit] - 61 beans defined in ApplicationContext [Root XmlWebApplicationContext]
[junit] - Creating shared instance of singleton bean 'messageSource'
[junit] - No ApplicationEventMulticaster found for context [Root XmlWebApplicationContext]: using default
[junit] - No ThemeSource found for [Root XmlWebApplicationContext]: using ResourceBundleThemeSource
[junit] - Refreshing listeners
[junit] - Pre-instantiating singletons in factory [org.springframework.beans.factory.support.Defau... ]; Root of BeanFactory hierarchy]
[junit] - Creating shared instance of singleton bean 'invController'
[junit] - Found action method [public org.springframework.web.servlet.ModelAndView com....
[junit] - Found action method [public final org.springframework.web.servlet.ModelAndView org.springframework.web.servlet.mvc.AbstractController.handleReques
t(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.lang.Exception]
[junit] - Hibernate 2.1.5
[junit] - hibernate.properties not found
[junit] - using CGLIB reflection optimizer
[junit] - configuring from resource: /hibernate.cfg.xml
[junit] - Configuration resource: /hibernate.cfg.xml
[junit] - Mapping resource: com/shopbotz/hibernate/domain/xml/Setting.hbm.xml
[junit] - Mapping class: ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 6:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it's commons-logging, so it depends on what logging system commons-logging think you are using ,)

I use log4j, and it works fine for me to disable/enable them.
Look at the sample log4j.properties in hibernate for details.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Log4j properties and junit
PostPosted: Mon Jan 10, 2005 3:04 pm 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
I am using my log4j.properties which works good in my application. It appears that maybe JUnit is not using the log4j.properties. I have it in the classpath, but I am not sure how to tell if it is being used? Maybe there is another default properties in the JUNIT.jar or something? Anyone have any ideas. My log4j.properties is in the classes directory with the rest of my config files and they are located correctly. Is there anything special you have to do to have JUNIT take the log props? (Sorry I guess this isn't really a Hibernate question.)


log4j.rootLogger=info, stdout, roll

######## Stdout ########
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} %C{1}(line:%L) %5p] %m%n
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Pattern to output the caller's file name and line number.
#log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

######## Basic File ########
log4j.appender.file=org.apache.log4j.FileAppender
# log.dir is initialized in SystemFilter
log4j.appender.file.File=${log.dir}/app.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%d{ABSOLUTE} %C{1}(line:%L) %5p] %m%n
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p [%t] %c:%L - %m%n
#log4j.appender.file.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

######## Rolling File #########
log4j.appender.roll=org.apache.log4j.RollingFileAppender
# log.dir is initialized in SystemFilter
#log4j.appender.roll.File=${log.dir}/app.log
log4j.appender.roll.File=/temp/dsz.log
log4j.appender.roll.MaxFileSize=2000KB
log4j.appender.roll.MaxBackupIndex=3
log4j.appender.roll.layout=org.apache.log4j.PatternLayout
log4j.appender.roll.layout.ConversionPattern=[%d{DATE} %C{1}(line:%L) %5p] %m%n
#log4j.appender.roll.layout.ConversionPattern=%p %t %c - %m%n
#log4j.appender.roll.layout.ConversionPattern=%d{ABSOLUTE} %5p [%t] %c:%L - %m%n
#log4j.appender.R.Threshold=warn


########## API specific logging ###########

## ---- Hibernate logging options --- ##

## Hibernate root property - this can be set to 'debug' for verbose detail ##
log4j.logger.net.sf.hibernate=warn
## JDBC bind parameters ##
log4j.logger.net.sf.hibernate.type=warn
## PreparedStatement cache activity ##
log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=warn
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=warn
### log schema export/update ###
log4j.logger.net.sf.hibernate.tool.hbm2ddl=warn

log4j.logger.org.apache.commons.beanutils=warn

log4j.logger.org.apache.catalina.session.ManagerBase=info


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 5:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i don't do anything special.

try set -Dlog4j.debug=true and see what log4j reports to you.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: -D debug setting
PostPosted: Mon Jan 10, 2005 6:22 pm 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
It doesn't appear to have any affect at all. Which really makes me consider that JUNIT is not using the log4j or at least my properties at all.

No idea why? My property file is in the classes directory. Even explicity listed it in the classpath reference in the build xml.

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 11, 2005 4:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
is log4j.jar in your junit path ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 11, 2005 4:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
is log4j.jar in your path ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: tomcat
PostPosted: Tue Jan 11, 2005 7:28 am 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
Not sure why, but removing Tomcat lib from my classpath and explicitly naming the servlet.jar seems to have done the trick. Not sure why as there isn't any log4j stuff there.

Cheers


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.