此内容没有您所选择的语言版本。

5.5.3. Sample XML Configuration for a Console Log Handler


The following procedure demonstrates a sample configuration for a console log handler.

Procedure 5.3. Configure the Console Log Handler

  1. Add the Log Handler Identifier Information

    The name property sets the unique identifier for this log handler.
    When autoflush is set to "true" the log messages will be sent to the handler's target immediately upon request.
    <subsystem xmlns="urn:jboss:domain:logging:1.2">
       <console-handler name="CONSOLE" autoflush="true">
    
    Copy to Clipboard Toggle word wrap
  2. Set the level Property

    The level property sets the maximum level of log messages recorded.
    <subsystem xmlns="urn:jboss:domain:logging:1.2">
       <console-handler name="CONSOLE" autoflush="true">
          <level name="INFO"/>
    
    Copy to Clipboard Toggle word wrap
  3. Set the encoding Output

    Use encoding to set the character encoding scheme to be used for the output.
    <subsystem xmlns="urn:jboss:domain:logging:1.2">
       <console-handler name="CONSOLE" autoflush="true">
          <level name="INFO"/>
          <encoding value="UTF-8"/>
    
    Copy to Clipboard Toggle word wrap
  4. Define the target Value

    The target property defines the system output stream where the output of the log handler goes. This can be System.err for the system error stream, or System.out for the standard out stream.
    <subsystem xmlns="urn:jboss:domain:logging:1.2">
       <console-handler name="CONSOLE" autoflush="true">
          <level name="INFO"/>
          <encoding value="UTF-8"/>
          <target value="System.out"/>
    
    Copy to Clipboard Toggle word wrap
  5. Define the filter-spec Property

    The filter-spec property is an expression value that defines a filter. The example provided defines a filter that does not match a pattern: not(match("JBAS.*")).
    <subsystem xmlns="urn:jboss:domain:logging:1.2">
       <console-handler name="CONSOLE" autoflush="true">
          <level name="INFO"/>
          <encoding value="UTF-8"/>
          <target value="System.out"/>
          <filter-spec value="not(match(&quot;JBAS.*&quot;))"/>
    
    Copy to Clipboard Toggle word wrap
  6. Specify the formatter

    Use formatter to list the log formatter used by the log handler.
    <subsystem xmlns="urn:jboss:domain:logging:1.2">
       <console-handler name="CONSOLE" autoflush="true">
          <level name="INFO"/>
          <encoding value="UTF-8"/>
          <target value="System.out"/>
          <filter-spec value="not(match(&quot;JBAS.*&quot;))"/>
          <formatter>
             <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
          </formatter>
       </console-handler>
    </subsystem>
    
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat