How can I configure logger in standalone.xml for write messages only for one class or package?
For example:
17:56:41 ERROR [com.google.test] (http-/0.0.0.0:8080-5) Test message Google
17:56:41 ERROR [com.yaahoo.test] (http-/0.0.0.0:8080-5) Test message Yaahoo
I want to select messages only for class com.google.test
My handler doesn't work
<periodic-rotating-file-handler name="FILE" autoflush="true">
<level name="ERROR"/>
<filter-spec value="any(match("[com.google.test]*"))"/>
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.base.dir" path="Error.log"/>
<suffix value=".yyyy-MM-dd"/>
</periodic-rotating-file-handler>
You may need to add a <logger>
section to that configuration
such as
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<logger category="com.google.test">
<level name="ERROR"/>
</logger>
You have defined the file handler but you haven't defined the logger, have you? You should add your logger in the standalone xml:
<logger category="com.google.test" use-parent-handlers="false">
<level name="ERROR"/>
<handlers>
<handler name="FILE"/>
</handlers>
</logger>
Also check the official documentation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.