English 中文(简体)
How in jboss write traces to separate trace file
原标题:
  • 时间:2009-11-16 15:32:41
  •  标签:
  • jboss
  • trace

How in JBoss to write traces to separate file?

I would like to see traces about org.hibernate.SQL and org.hibernate.type in separate trace file.

I added next appender and categories to jboss-log4j.xml but it does not help - jboss still writes traces into server.log.

<appender name="HIBERNATE" class="org.jboss.logging.appender.DailyRollingFileAppender">
        <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
        <param name="File" value="/u1/trace/sql.log"/>
        <param name="Append" value="true"/>
        <param name="DatePattern" value=" . yyyy-MM-dd"/>
        <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
        </layout>
</appender>


<category name="org.hibernate.SQL">
      <priority value="DEBUG"/>
      <appender-ref ref="HIBERNATE" />
</category>

<category name="org.hibernate.type">
      <priority value="TRACE"/>
      <appender-ref ref="HIBERNATE" />
</category>
最佳回答

Adding appenders to a category is "additive" meaning that the new appender is logged to in addition to the existing root appender. You need to explicitly stop it from doing that:

<category name="org.hibernate.SQL">
      <priority value="DEBUG"/>
      <appender-ref ref="HIBERNATE" additivity="false"/>
</category>
问题回答

The following setup works for me:

<category name="com.foobar.gearbox" additivity="false">
   <priority value="DEBUG" />
   <appender-ref ref="GB-FILE" />
</category>




相关问题
C# TraceSource class in multithreaded application

msdn: "Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe." it contains only instance methods. How should I ...

How to implement objects modification trace

With django admin, we have an history of who altered an object and when. I would like to add an "old value", "new value" to this to be able to roll back if needed. Plus I would like every ...

How to use TRACE with ascii under unicode MFC environment?

I am developing a MFC program under windows CE. It is unicode by default. I can use TRACE to print some message like this TRACE(TEXT("Hey! we got a problem! ")); It works fine if everything is ...

high speed tracing

I have an embedded board with a 32 Micro-controller, and an custom built OS, Unfortunately, as of now, connection to the PC is only through serial port, Internal memory is limited to 512KB. There are ...

Tracking SQL Calls From MS Access to MySQL

I m trying to see the SQL statements that are sent from MS Access 2003 to MySQL via ODBC. I ve tried ODBC Tracing, but it s painfully slow, producing very large log files which are very difficult ...

How in jboss write traces to separate trace file

How in JBoss to write traces to separate file? I would like to see traces about org.hibernate.SQL and org.hibernate.type in separate trace file. I added next appender and categories to jboss-log4j....

热门标签