<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>betweenGo &#187; Logging</title>
	<atom:link href="http://betweengo.com/category/apache/logging/feed/" rel="self" type="application/rss+xml" />
	<link>http://betweengo.com</link>
	<description>We make Ruby on Rails easy.  We make ATG easy.</description>
	<lastBuildDate>Tue, 06 Dec 2011 14:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Unit Test for Threaded Logging</title>
		<link>http://betweengo.com/2009/05/04/unit-test-for-threaded-logging/</link>
		<comments>http://betweengo.com/2009/05/04/unit-test-for-threaded-logging/#comments</comments>
		<pubDate>Mon, 04 May 2009 17:18:45 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Java SE]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=709</guid>
		<description><![CDATA[Brian Ploetz sent me this great unit test for threaded logging.  In it we are trying to find if a deadlock occurs. import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.log4j.Appender; import org.apache.log4j.Logger; /** * Unit test for the ThrottlingFilter in a multi-threaded environment */ public class ThrottlingFilterThreadUTest extends TestCase [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/' rel='bookmark' title='How to Log SQL on JBoss'>How to Log SQL on JBoss</a></li>
<li><a href='http://betweengo.com/2008/05/27/log4j-levels/' rel='bookmark' title='Log4j levels'>Log4j levels</a></li>
<li><a href='http://betweengo.com/2007/02/07/accessing-javabeans-getters-and-setters/' rel='bookmark' title='Accessing JavaBean&#8217;s Getters and Setters'>Accessing JavaBean&#8217;s Getters and Setters</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a title="Brian Ploetz" href="http://www.linkedin.com/in/bploetz">Brian Ploetz</a> sent me this great unit test for threaded logging.  In it we are trying to find if a deadlock occurs.</p>
<pre>import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

import junit.framework.TestCase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Appender;
import org.apache.log4j.Logger;

/**
 * Unit test for the ThrottlingFilter in a multi-threaded environment
 */
public class ThrottlingFilterThreadUTest extends TestCase {

  private static final Log logger = LogFactory.getLog(ThrottlingFilterThreadUTest.class);

  private static ThreadMXBean threadMXBean;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    threadMXBean = ManagementFactory.getThreadMXBean();
    logger.info("Thread contention monitoring supported: "
        + threadMXBean.isThreadContentionMonitoringSupported());
    logger.info("Thread contention monitoring enabled: "
        + threadMXBean.isThreadContentionMonitoringEnabled());
    threadMXBean.setThreadContentionMonitoringEnabled(true);
    logger.info("Thread contention monitoring enabled: "
        + threadMXBean.isThreadContentionMonitoringEnabled());
  }

  /**
   * Tests multiple threads using the same filter instance at the same time
   */
  public void testThreads() {
    Logger rootLogger = Logger.getRootLogger();
    assertNotNull(rootLogger);
    Appender fileAppender = rootLogger.getAppender("FILE");
    assertNotNull(fileAppender);
    ThrottlingFilter throttlingFilter = (ThrottlingFilter) fileAppender.getFilter();
    assertNotNull(throttlingFilter);

    ThreadGroup infoThreadGroup = new ThreadGroup("info-group");
    ThreadGroup errorThreadGroup = new ThreadGroup("error-group");
    Thread errorThread1 = new ErrorThread(errorThreadGroup, "error-thread-1");
    Thread infoThread1 = new InfoThread(infoThreadGroup, "info-thread-1");
    Thread errorThread2 = new ErrorThread(errorThreadGroup, "error-thread-2");
    Thread infoThread2 = new InfoThread(infoThreadGroup, "info-thread-2");
    infoThread1.start();
    errorThread1.start();
    errorThread2.start();
    infoThread2.start();

    while (true) {
      ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(threadMXBean.getAllThreadIds());
      for (int i = 0; i &lt; threadInfos.length; i++) {
        ThreadInfo threadInfo = threadInfos[i];
        if (threadInfo != null &amp;&amp; threadInfo.getThreadState() == Thread.State.BLOCKED) {
          System.out.println("Thread '" + threadInfo.getThreadName()
              + "' is blocked on the monitor lock '" + threadInfo.getLockName()
              + "' held by thread '" + threadInfo.getLockOwnerName() + "'");
        }
      }

      if (!infoThread1.isAlive() &amp;&amp; !errorThread1.isAlive() &amp;&amp; !infoThread2.isAlive()
          &amp;&amp; !errorThread2.isAlive())
        break;
    }
  }

  public static class ErrorThread extends Thread {

    private static final Log logger = LogFactory.getLog(ErrorThread.class);

    public ErrorThread(ThreadGroup tg, String name) {
      super(tg, name);
    }

    public void run() {
      for (int i = 0; i &lt; 10; i++) {
        try {
          test(0);
        } catch (Exception e) {
          long start = System.currentTimeMillis();
          logger.error("Error!", e);
          long end = System.currentTimeMillis();
          System.out.println("Took " + (end-start) + "ms to log error");
        }
      }
    }

    // simulate large stack traces
    private void test(int i) {
      if (i &gt;= 500)
        throw new RuntimeException("D'OH!");
      test(i+1);
    }
  }

  public static class InfoThread extends Thread {

    private static final Log logger = LogFactory.getLog(InfoThread.class);

    public InfoThread(ThreadGroup tg, String name) {
      super(tg, name);
    }

    public void run() {
      for (int i = 0; i &lt; 100; i++) {
        logger.info("Hi!");
      }
    }
  }
}</pre>
<p>The log4j.xml test file.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;

&lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
    debug="false"&gt;

    &lt;!-- ================================= --&gt;
    &lt;!--           Appenders               --&gt;
    &lt;!-- ================================= --&gt;

    &lt;!-- A time/date based rolling file appender --&gt;
    &lt;appender name="FILE"
        class="org.apache.log4j.DailyRollingFileAppender"&gt;
        &lt;param name="File" value="server.log" /&gt;
        &lt;param name="Append" value="true" /&gt;

        &lt;!-- Rollover at midnight each day --&gt;
        &lt;param name="DatePattern" value="'.'yyyy-MM-dd" /&gt;

        &lt;layout class="org.apache.log4j.PatternLayout"&gt;
            &lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;
            &lt;param name="ConversionPattern" value="%d %-5p [%c] %m%n" /&gt;
        &lt;/layout&gt;

        &lt;filter class="com.betweengo.log4j.ThrottlingFilter"&gt;
          &lt;param name="maxCountSameMessage" value="100"/&gt;
          &lt;param name="maxCountSavedMessages" value="100"/&gt;
          &lt;param name="waitInterval" value="60"/&gt;
        &lt;/filter&gt;
    &lt;/appender&gt;

    &lt;!-- ======================= --&gt;
    &lt;!-- Setup the Root category --&gt;
    &lt;!-- ======================= --&gt;

    &lt;root&gt;
        &lt;level value="INFO" /&gt;
        &lt;appender-ref ref="FILE" /&gt;
    &lt;/root&gt;

&lt;/log4j:configuration&gt;</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2009%2F05%2F04%2Funit-test-for-threaded-logging%2F&amp;title=Unit%20Test%20for%20Threaded%20Logging" id="wpa2a_2"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/' rel='bookmark' title='How to Log SQL on JBoss'>How to Log SQL on JBoss</a></li>
<li><a href='http://betweengo.com/2008/05/27/log4j-levels/' rel='bookmark' title='Log4j levels'>Log4j levels</a></li>
<li><a href='http://betweengo.com/2007/02/07/accessing-javabeans-getters-and-setters/' rel='bookmark' title='Accessing JavaBean&#8217;s Getters and Setters'>Accessing JavaBean&#8217;s Getters and Setters</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/05/04/unit-test-for-threaded-logging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling Trace Level Debugging in JBoss</title>
		<link>http://betweengo.com/2008/07/05/enabling-trace-level-debugging-in-jboss/</link>
		<comments>http://betweengo.com/2008/07/05/enabling-trace-level-debugging-in-jboss/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 20:34:21 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Logging]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=208</guid>
		<description><![CDATA[In JBoss 4.0.4.GA it took me awhile to figure out how to enable trace level debugging. Typically you could do something like this to enable trace level debugging for a category of classes. &#60;category name="com.betweengo.app"&#62; &#60;priority value="TRACE"/&#62; &#60;/category&#62; However JBoss 4.0.4.GA has an older log4j implementation so you need to use JBoss&#8217;s custom TRACE level. [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/' rel='bookmark' title='How to Log SQL on JBoss'>How to Log SQL on JBoss</a></li>
<li><a href='http://betweengo.com/2010/01/28/enabling-non-xa-resources-in-jboss-4-2-with-atg/' rel='bookmark' title='Enabling non-XA Resources in JBoss 4.2 with ATG'>Enabling non-XA Resources in JBoss 4.2 with ATG</a></li>
<li><a href='http://betweengo.com/2008/05/27/log4j-levels/' rel='bookmark' title='Log4j levels'>Log4j levels</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In JBoss 4.0.4.GA it took me awhile to figure out how to enable trace level debugging.</p>
<p>Typically you could do something like this to enable trace level debugging for a category of classes.</p>
<pre>&lt;category  name="com.betweengo.app"&gt;
  &lt;priority  value="TRACE"/&gt;
&lt;/category&gt;</pre>
<p>However JBoss 4.0.4.GA has an older log4j implementation so you need to use JBoss&#8217;s custom TRACE level.</p>
<pre>&lt;category  name="com.betweengo.app"&gt;
  &lt;priority  value="TRACE" class="org.jboss.logging.XLevel"/&gt;
&lt;/category&gt;</pre>
<p>This is documented in the release notes for JBoss-4.2.1.GA.</p>
<blockquote><p>Since the latest log4j includes a trace level, there is no need to reference the custom jboss TRACE level in conf/jboss-log4j.xml configs, JBAS-4163.</p></blockquote>
<p>There is additional information on trace level debugging in the articles <a title="JBossWiki : JBossMessagingUser_Enabling_TRACE_logging_on_server" href="http://wiki.jboss.org/wiki/JBossMessagingUser_Enabling_TRACE_logging_on_server">Enabling TRACE logging on server </a>and <a title="JBoss.com - logging" href="http://www.jboss.com/developers/guides/logging">Using Logging</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2008%2F07%2F05%2Fenabling-trace-level-debugging-in-jboss%2F&amp;title=Enabling%20Trace%20Level%20Debugging%20in%20JBoss" id="wpa2a_4"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/' rel='bookmark' title='How to Log SQL on JBoss'>How to Log SQL on JBoss</a></li>
<li><a href='http://betweengo.com/2010/01/28/enabling-non-xa-resources-in-jboss-4-2-with-atg/' rel='bookmark' title='Enabling non-XA Resources in JBoss 4.2 with ATG'>Enabling non-XA Resources in JBoss 4.2 with ATG</a></li>
<li><a href='http://betweengo.com/2008/05/27/log4j-levels/' rel='bookmark' title='Log4j levels'>Log4j levels</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/07/05/enabling-trace-level-debugging-in-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Log4j levels</title>
		<link>http://betweengo.com/2008/05/27/log4j-levels/</link>
		<comments>http://betweengo.com/2008/05/27/log4j-levels/#comments</comments>
		<pubDate>Wed, 28 May 2008 03:09:02 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Logging]]></category>
		<category><![CDATA[log4j]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=186</guid>
		<description><![CDATA[I always forget which level is which in Log4j so I copied this from the JavaDoc for the Level class. static Level ALL The ALL has the lowest possible rank and is intended to turn on all logging. static Level DEBUG The DEBUG Level designates fine-grained informational events that are most useful to debug an [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2008/07/05/enabling-trace-level-debugging-in-jboss/' rel='bookmark' title='Enabling Trace Level Debugging in JBoss'>Enabling Trace Level Debugging in JBoss</a></li>
<li><a href='http://betweengo.com/2005/08/11/mysterious-404-errors-atg-j2ee-apps/' rel='bookmark' title='Mysterious 404 errors in ATG J2EE applications'>Mysterious 404 errors in ATG J2EE applications</a></li>
<li><a href='http://betweengo.com/2007/02/06/accessing-class-from-static-method-within-class/' rel='bookmark' title='Accessing the class from a static method which the class owns'>Accessing the class from a static method which the class owns</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I always forget which level is which in <a title="Log4j 1.2" href="http://logging.apache.org/log4j/1.2/index.html">Log4j</a> so I copied this from the JavaDoc for the <a title="Level (Apache Log4j 1.2.15 API)" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a> class.</p>
<table border="1" cellspacing="0" cellpadding="3" width="100%">
<tbody>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#ALL">ALL</a></strong></code><br />
The <code>ALL</code> has the lowest possible rank and is intended to      turn on all logging.</td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#DEBUG">DEBUG</a></strong></code><br />
The <code>DEBUG</code> Level designates fine-grained      informational events that are most useful to debug an      application.</td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#ERROR">ERROR</a></strong></code><br />
The <code>ERROR</code> level designates error events that      might still allow the application to continue running.</td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#FATAL">FATAL</a></strong></code><br />
The <code>FATAL</code> level designates very severe error      events that will presumably lead the application to abort.</td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#INFO">INFO</a></strong></code><br />
The <code>INFO</code> level designates informational messages      that highlight the progress of the application at coarse-grained      level.</td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#OFF">OFF</a></strong></code><br />
The <code>OFF</code> has the highest possible rank and is      intended to turn off logging.</td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#TRACE">TRACE</a></strong></code><br />
The <code>TRACE</code> Level designates finer-grained  informational events than the <code>DEBUG</code></td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td width="1%" align="right" valign="top"><span> <code>static <a title="class in org.apache.log4j" href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html">Level</a></code></span></td>
<td><code><strong><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#WARN">WARN</a></strong></code><br />
The <code>WARN</code> level designates potentially harmful situations.</td>
</tr>
</tbody>
</table>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2008%2F05%2F27%2Flog4j-levels%2F&amp;title=Log4j%20levels" id="wpa2a_6"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2008/07/05/enabling-trace-level-debugging-in-jboss/' rel='bookmark' title='Enabling Trace Level Debugging in JBoss'>Enabling Trace Level Debugging in JBoss</a></li>
<li><a href='http://betweengo.com/2005/08/11/mysterious-404-errors-atg-j2ee-apps/' rel='bookmark' title='Mysterious 404 errors in ATG J2EE applications'>Mysterious 404 errors in ATG J2EE applications</a></li>
<li><a href='http://betweengo.com/2007/02/06/accessing-class-from-static-method-within-class/' rel='bookmark' title='Accessing the class from a static method which the class owns'>Accessing the class from a static method which the class owns</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/05/27/log4j-levels/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Log SQL on JBoss</title>
		<link>http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/</link>
		<comments>http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/#comments</comments>
		<pubDate>Wed, 05 Apr 2006 05:27:05 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[log4j]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=74</guid>
		<description><![CDATA[Edit the log4j.xml in the conf directory as shown below to turn on SQL debugging of the JDBC CMP plugin. /apps/jboss/server/default/conf :-&#62;diff -c log4j.xml~ log4j.xml *** log4j.xml~ Mon Sep 30 18:09:27 2002 --- log4j.xml Tue Apr 4 20:41:18 2006 *************** *** 61,73 **** &#60;!-- ============================== --&#62; &#60;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&#62; ! &#60;param name="Threshold" value="INFO"/&#62; &#60;param name="Target" [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2008/07/05/enabling-trace-level-debugging-in-jboss/' rel='bookmark' title='Enabling Trace Level Debugging in JBoss'>Enabling Trace Level Debugging in JBoss</a></li>
<li><a href='http://betweengo.com/2009/05/04/unit-test-for-threaded-logging/' rel='bookmark' title='Unit Test for Threaded Logging'>Unit Test for Threaded Logging</a></li>
<li><a href='http://betweengo.com/2008/05/27/log4j-levels/' rel='bookmark' title='Log4j levels'>Log4j levels</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Edit the <code>log4j.xml</code> in the <code>conf</code> directory as shown below to turn on SQL debugging of the JDBC CMP plugin.</p>
<pre>/apps/jboss/server/default/conf :-&gt;diff -c log4j.xml~ log4j.xml
*** log4j.xml~  Mon Sep 30 18:09:27 2002
--- log4j.xml   Tue Apr  4 20:41:18 2006
***************
*** 61,73 ****
    &lt;!-- ============================== --&gt;

    &lt;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&gt;
!     &lt;param name="Threshold" value="INFO"/&gt;
      &lt;param name="Target" value="System.out"/&gt;

      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
        &lt;!-- The default pattern: Date Priority [Category] Message\\n --&gt;
        &lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/&gt;

      &lt;/layout&gt;
    &lt;/appender&gt;

--- 61,79 ----
    &lt;!-- ============================== --&gt;

    &lt;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&gt;
!     &lt;!--&lt;param name="Threshold" value="INFO"/&gt;--&gt;
!     &lt;param name="Threshold" value="DEBUG"/&gt;
      &lt;param name="Target" value="System.out"/&gt;

      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
        &lt;!-- The default pattern: Date Priority [Category] Message\\n --&gt;
        &lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/&gt;

      &lt;/layout&gt;
+
+     &lt;category name="org.jboss.ejb.plugins.cmp.jdbc"&gt;
+       &lt;priority value="DEBUG"/&gt;
+     &lt;/category&gt;
+
    &lt;/appender&gt;</pre>
<p>If you want to log Hibernate SQL statements:</p>
<pre>    &lt;category name="org.hibernate.SQL"&gt;
      &lt;priority value="DEBUG"/&gt;
    &lt;/category&gt;</pre>
<p>If you want to log everything Hibernate&#8217;s doing, including SQL statements, schema export, transactions, etc.:</p>
<pre>    &lt;category name="org.hibernate.SQL"&gt;
      &lt;priority value="DEBUG"/&gt;
    &lt;/category&gt;</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2006%2F04%2F04%2Fhowto-log-sql-on-jboss%2F&amp;title=How%20to%20Log%20SQL%20on%20JBoss" id="wpa2a_8"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2008/07/05/enabling-trace-level-debugging-in-jboss/' rel='bookmark' title='Enabling Trace Level Debugging in JBoss'>Enabling Trace Level Debugging in JBoss</a></li>
<li><a href='http://betweengo.com/2009/05/04/unit-test-for-threaded-logging/' rel='bookmark' title='Unit Test for Threaded Logging'>Unit Test for Threaded Logging</a></li>
<li><a href='http://betweengo.com/2008/05/27/log4j-levels/' rel='bookmark' title='Log4j levels'>Log4j levels</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
