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

io.dropwizard.request.logging.layout.LogbackAccessRequestLayout Maven / Gradle / Ivy

There is a newer version: 5.0.0-alpha.2
Show newest version
package io.dropwizard.request.logging.layout;

import ch.qos.logback.access.PatternLayout;
import ch.qos.logback.core.Context;

import java.util.TimeZone;

/**
 * A base layout for Logback Access request logs.
 * 
    *
  • Extends {@link PatternLayout}.
  • *
  • Disables pattern headers.
  • *
  • Sets the pattern to the given timezone.
  • *
*/ public class LogbackAccessRequestLayout extends PatternLayout { static { // Replace the buggy default converter which don't work async appenders defaultConverterMap.put("requestParameter", SafeRequestParameterConverter.class.getName()); defaultConverterMap.put("reqParameter", SafeRequestParameterConverter.class.getName()); } public LogbackAccessRequestLayout(Context context, TimeZone timeZone) { setOutputPatternAsHeader(false); setPattern("%h %l %u [%t{dd/MMM/yyyy:HH:mm:ss Z," + timeZone.getID() + "}] \"%r\" %s %b \"%i{Referer}\" \"%i{User-Agent}\" %D"); setContext(context); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy