diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java b/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java
index fe1ed29929b696f6d76a812d36f87d45c7312cd4..9e9488b28f6bff8cc86a52a15bdaa3b46ac2babc 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java
@@ -13,44 +13,47 @@
*/
package ch.qos.logback.classic;
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
+import ch.qos.logback.classic.layout.TTLLLayout;
import ch.qos.logback.classic.spi.Configurator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
+import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
import ch.qos.logback.core.spi.ContextAwareBase;
-import ch.qos.logback.core.status.InfoStatus;
-import ch.qos.logback.core.status.StatusManager;
/**
* BasicConfigurator configures logback-classic by attaching a
* {@link ConsoleAppender} to the root logger. The console appender's layout
- * is set to a {@link PatternLayout} with the pattern
- * "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n".
+ * is set to a {@link ch.qos.logback.classic.layout.TTLLLayout TTLLLayout}.
*
- * @author Ceki Gulcu
+ * @author Ceki Gülcü
*/
public class BasicConfigurator extends ContextAwareBase implements Configurator {
- //final static BasicConfigurator hiddenSingleton = new BasicConfigurator();
-
public BasicConfigurator() {
}
public void configure(LoggerContext lc) {
- StatusManager sm = lc.getStatusManager();
- if (sm != null) {
- sm.add(new InfoStatus("Setting up default configuration.", lc));
- }
+ addInfo("Setting up default configuration.");
+
ConsoleAppender
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n+ * + *
TTLLLayout has the advantage of faster load time whereas {@link ch.qos.logback.classic.PatternLayout PatternLayout} + * requires roughly 40 milliseconds to load its parser classes. Note that the second run of PatternLayout will be much much faster (approx. 10 micro-seconds).
+ * + *Fixed format layouts such as TTLLLayout should be considered as an alternative to PatternLayout only if the extra 40 milliseconds at application start-up is considered significant.
+ * + * @author Ceki Gülcü + * @since 1.1.6 + */ +public class TTLLLayout extends LayoutBaseIf no such file is found, and the executing JVM has the
-
- ServiceLoader (JDK 6 and above) the ServiceLoader will be used to resolve an
- implementation of
- com.qos.logback.classic.spi.Configurator
.
- The first implementation found will be used.
- See
- ServiceLoader documentation for more details.
+
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.
+
If none of the above succeeds, logback configures itself @@ -120,21 +124,28 @@ -
The fourth and last step is meant to provide a default (but - very basic) logging functionality in the absence of a +
The last step is meant as last-ditch effort to provide a + default (but very basic) logging functionality in the absence of a configuration file.
If you are using Maven and if you place the - logback-test.xml under the - src/test/resources folder, Maven will ensure that it - won't be included in the artifact produced. Thus, you can use a - different configuration file, namely logback-test.xml - during testing, and another file, namely, logback.xml, in - production. The same principle applies by analogy for Ant. + logback-test.xml under the src/test/resources + folder, Maven will ensure that it won't be included in the + artifact produced. Thus, you can use a different configuration + file, namely logback-test.xml during testing, and another + file, namely, logback.xml, in production.
+Fast start-up It takes about 100
+ miliseconds for Joran to parse a given logback configuration
+ file. To shave off those miliseconds at aplication start up, you
+ can use the service-provider loading facility (item 4 above) to
+ load your own custom Configurator
class with BasicConfigrator
+ serving as a good starting point.
LogbackValve
(in logback-access) now attempts to
+
LogbackValve
(in logback-access) now attempts to
load the configuration file as a resource if it cannot be found on
the filesystem (LOGBACK-1069). This
@@ -63,6 +63,15 @@
by Paulius Matulionis. Analysis of the problem and the relevant PR
was provided by Ferenc Palkovics.
BasicConfigurator.configure
method call executes
+ significatly faster. Improved documentation for configuration
+ using JDK 1.6 service-provider facility. These changes are in
+ response to LOGBACK-1141
+ requesting faster logback start-up time.
+
Fixed issue with variable substitution with the value ending in a colon. This problem was reported in LOGBACK-1140 by