{"id":5073,"date":"2014-03-30T18:39:31","date_gmt":"2014-03-30T18:39:31","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-configure-commons-logging-for-junit-testing-of-hibernate-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:39:31","modified_gmt":"2014-03-30T18:39:31","slug":"how-to-configure-commons-logging-for-junit-testing-of-hibernate-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-configure-commons-logging-for-junit-testing-of-hibernate-collection-of-common-programming-errors\/","title":{"rendered":"How to configure commons-logging for JUnit testing of Hibernate-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to debug some hibernate functionality in a spring app with a junit test and commons logging, but I can&#8217;t seem to get anything other than the default INFO messages to appear. I&#8217;m also running these junit tests from Eclipse.<\/p>\n<p>I&#8217;ve had no luck from the spring forums either.<\/p>\n<p>I&#8217;m particularly interested in the debug logging output by Hibernate (to try and figure out why it takes 23 seconds to run this test).<\/p>\n<p>Current output shows the default setting of INFO:<\/p>\n<pre>Mar 29, 2011 4:44:35 PM org.springframework.test.AbstractTransactionalSpringContextTests onSetUp\nINFO: Began transaction: transaction manager [org.springframework.orm.hibernate3.HibernateTransactionManager@5f873eb2]; defaultRollback true\ntestGetSubjectsForSite time: [00:00:00:068]\nMar 29, 2011 4:44:58 PM org.springframework.test.AbstractTransactionalSpringContextTests endTransaction\nINFO: Rolled back transaction after test execution<\/pre>\n<p>I&#8217;ve tried to add a commons-logging.properties file to the classpath (the same location as the hibernate.properties and test-components.xml) but still only the default INFO messages appear.<\/p>\n<p>Here&#8217;s the commons-logging.properties file:<\/p>\n<pre><code>org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger\n\n# handlers\nhandlers=java.util.logging.ConsoleHandler\n\n# default log level\n.level=FINE\norg.springframework.level=FINE\norg.hibernate.level=FINE\n\n# level for the console logger\njava.util.logging.ConsoleHandler.level=FINE\njava.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter\n<\/code><\/pre>\n<p>Is anyone able to shed any light on why I can&#8217;t get the DEBUG messages to print out? Is there a logging setting I&#8217;m missing?<\/p>\n<p><strong>Edit:<\/strong> I&#8217;ve tried FINEST and DEBUG to no avail.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to debug some hibernate functionality in a spring app with a junit test and commons logging, but I can&#8217;t seem to get anything other than the default INFO messages to appear. I&#8217;m also running these junit tests from Eclipse. I&#8217;ve had no luck from the spring forums either. I&#8217;m particularly interested in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5073","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5073"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5073\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}