donaricano-btn

Configuration-Syntax

As will be demonstrated over and over, the syntax of logback configuration files is extremely flexible. As such, it is not possible to specify the allowed syntax with a DTD file or an XML schema. Nevertheless, the very basic structure of the configuration file can be described as, <configuration> element, containing zero or more <appender> elements, followed by zero or more <logger> elements, followed by at most one <root> element.


1. Case sensitivity of tag names

Since logback version 0.9.17, tag names pertaining to explicit rules are case insensitive.

For example, <logger>, <Logger> and <LOGER> are valid configuration elements and will be interpreted in the same way


2. Configuring loggers, of the <logger> element

A logger is configured using the <logger> element. A <logger> element takes exactly one mandatory name attribute, an optional level attribute, and an optional additivity attribute, admitting the values true or false.


The <logger> element may contain zero or more <appender-ref> element


3. Configuring the root logger, or the <root> element

The <root> element configures the root logger. It supports a single attribute, namely the level attribute.


4. Example - Setting the level of a logger

4_1. logback.xml

4_2. MyAppLog.java and Foo

4_3. Console

- Note that the message of level DEBUG generated by the "Foo" logger has been suppressed


5. Example - Setting the level of multiple loggers

I can configure the levels of as many loggers as I wish

- Note that the level of the root logger is always set to a non-value, DEBUG by default

블로그 이미지

리딩리드

,