I have this standalone.xml configuration in a subsystem:
<subsystem xmlns="urn:jboss:domain:logging:3.0">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE">
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<periodic-rotating-file-handler name="CMP">
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="CMP.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="org.hibernate.SQL">
<level name="DEBUG"/>
<handlers>
<handler name="CMP"/>
</handlers>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
</subsystem>
When I run the application, it prints the org.hibernate.SQL (SQL queries for example) in both files, but I want to it prints the org.hibernate.SQL only in CMP.log file.
How can I exclude org.hibernate.SQL writes from server.log and print it only in CMP.log file?
You need to set the
use-parent-handlers
tofalse
on theorg.hibernate.SQL
logger. With CLI you'd do something like: