donaricano-btn

Configuration_1

LogBack can be configured either programmatically or with a configuration script expressed in XML or Groovy format.

By the way, existing log4j users can convert their log4.properties files to logback.xml using our Properties Translator web-application


Let us begin by discussing the initialization steps that logback follows to try to configure itself]

1) Logback tries to find a file called logback.groovy in the classpath

2) If no such file is found, logback tries to find a file called logback-test.xml in the classpath

3) If no such file is found, it checks for the file logback.xml in the classpath

4) If no such file is found, service-provider loading facility(introduced in JDK 1.6) is used to resolve the implementation of com.qos.logback.classic.spi.Configurator interface by looking up the file META-INF/services/ch.qos.logback.classic.spi.Configurator in the class path.

Its contents should specify the fully qualified class name of the desired Configurator implementation


5) If none of the above succeeds, logback configures itself automatically using the BasicConfigurator which will cause logging output to be directed to the console


1. Automatically configuring logback

- The simplest way to configure logback is by letting logback fall back to its default configuration

- logback will default to invoking BasicConfigurator which will set up a minimal configuration.

This minimal configuration consists of a ConsoleAppender attached to the root logger. The output is formatted using a PatternLayoutEncoder set to the pattern


1_1. MyAppLog


1_2. Foo


1_3. console



'Logging > LogBack' 카테고리의 다른 글

[LogBack] 3_3. Configuration-Syntax  (0) 2016.06.03
[LogBack] 3_2. Configuration-with logback-test.xml or logback.xml  (0) 2016.06.02
[LogBack] 2. Architecture  (0) 2016.05.26
[LogBack] 1. Introduction  (0) 2016.05.25
[LogBack] 0. Define  (0) 2016.05.25
블로그 이미지

리딩리드

,