JBoss Community Archive (Read Only)

WildFly 8

Handlers

WIP

This is still a work in progress. Please feel free to edit any mistakes you find images/author/images/icons/emoticons/smile.gif .

Overview

Handlers are used to determine what happens with a log message if the logger determines the message is loggable.

There are 6 main handlers provided with WildFly and 1 generic handler;

async-handler

An async-handler is a handler that asynchronously writes log messages to it's child handlers. This type of handler is generally used for other handlers that take a substantial time to write logged messages.

console-handler

A console-handler is a handler that writes log messages to the console. Generally this writes to stdout, but can be set to write to stderr.

file-handler

A file-handler is a handler that writes log messages to the specified file.

periodic-rotating-file-handler

A periodic-rotating-file-handler is a handler that writes log messages to the specified file. The file rotates on the date pattern specified in the suffix attribute. The suffix must be a valid pattern recognized by the java.text.SimpleDateFormat and must not rotate on seconds or milliseconds.

The rotate happens before the next message is written by the handler.

size-rotating-file-handler

A size-rotating-file-handler is a handler that writes log messages to the specified file. The file rotates when the file size is greater than the rotate-size attribute. The rotated file will be kept and the index appended to the name moving previously rotated file indexes up by 1 until the max-backup-index is reached. Once the max-backup-index is reached, the indexed files will be overwritten.

The rotate happens before the next message is written by the handler.

syslog-handler

A syslog-handler is a handler that writes to a syslog server. The handler support RFC3164 or RFC5424 formats.

Attributes

The syslog-handler is missing some configuration properties that may be useful in some scenarios like setting a formatter. Use the org.jboss.logmanager.handlers.SyslogHandler in module org.jboss.logmanager as a custom-handler to exploit these benefits. Additional attributes will be added at some point so this will no longer be necessary.

custom-handler

Attributes

autoflush

Description:

Indicates whether a flush should happen after each write.

Type:

boolean

Default Value:

true

Allowed Values:

true or false

enabled

Description:

If set to true the handler is enabled and functioning as normal, if set to false the handler is ignored when processing log messages.

Type:

boolean

Default Value:

true

Allowed Values:

true or false

encoding

Description:

The character encoding used by this Handler.

Type:

string

Default Value:

null

Allowed Values:

Any valid encoding

file

Description:

An object describing the file the handler should write to.

Type:

object

Default Value:

null

Allowed Values:

An object optionally containing a relative-to property and a path. The path is a required property of the object.

named-formatter

Description:

The name of a defined formatter to be used on the handler.

Type:

string

Default Value:

null

Allowed Values:

TODO add link

formatter

Description:

Defines a pattern for a pattern formatter.

Type:

string

Default Value:

%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n

Allowed Values:

TODO add link

filter-spec

Description:

A filter expression value to define a filter.

Type:

string

Default Value:

null

Allowed Values:

See Filter Expression

level

Description :

The log level specifying which message levels will be logged by this logger. Message levels lower than this value will be discarded.

Type:

string

Default Value:

ALL

Allowed Values:

  • ALL

  • FINEST

  • FINER

  • TRACE

  • DEBUG

  • FINE

  • CONFIG

  • INFO

  • WARN

  • WARNING

  • ERROR

  • SEVERE

  • FATAL

  • OFF

backup-index

Description:

The maximum number of rotated files to keep.

Type:

integer

Default Value:

1

Allowed Values:

any integer greater than 0

overflow-action

Description:

Specify what action to take when the overflowing.

Type:

string

Default Value:

BLOCK

Allowed Values:

BLOCK or DISCARD

queue-length

Description:

The queue length to use before flushing writing

Type:

integer

Default Value:

0

Allowed Values:

any positive integer

rotate-on-boot

Description:

Indicates whether or not the file should be rotated each time the file attribute is changed.

If set to true will rotate on each boot of the server.

Type:

boolean

Default Value:

false

Allowed Values:

true or false

rotate-size

Description:

The size at which the file should be rotated.

Type:

string

Default Value:

2m

Allowed Values:

Any positive integer with a size type appended to the end. Valid types are b for bytes, k for kilobytes, m for megabytes, g for gigabytes or t for terabytes. Type character is not case sensitive.

subhandlers

Description:

The handlers to associate with the async handler

Type:

list of strings

Default Value:

null

Allowed Values:

An array of valid handler names

suffix

Description:

The pattern used to determine when the file should be rotated.

Type:

string

Default Value:

null

Allowed Values:

Any valid java.text.SimpleDateFormat pattern.

target

Description:

Defines the target of the console handler.

Type:

string

Default Value:

System.out

Allowed Values:

System.out or System.err

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 13:47:11 UTC, last content change 2013-12-20 23:59:37 UTC.