All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.logging.DropwizardLayout Maven / Gradle / Ivy

package io.dropwizard.logging;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.PatternLayout;

import java.util.TimeZone;

/**
 * A base layout for Dropwizard.
 * 
    *
  • Disables pattern headers.
  • *
  • Prefixes logged exceptions with {@code !}.
  • *
  • Sets the pattern to the given timezone.
  • *
*/ public class DropwizardLayout extends PatternLayout { public DropwizardLayout(LoggerContext context, TimeZone timeZone) { super(); setOutputPatternAsHeader(false); getDefaultConverterMap().put("ex", PrefixedThrowableProxyConverter.class.getName()); getDefaultConverterMap().put("xEx", PrefixedExtendedThrowableProxyConverter.class.getName()); getDefaultConverterMap().put("rEx", PrefixedRootCauseFirstThrowableProxyConverter.class.getName()); setPattern("%-5p [%d{ISO8601," + timeZone.getID() + "}] %c: %m%n%rEx"); setContext(context); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy