io.dropwizard.logging.AppenderFactory Maven / Gradle / Ivy
package io.dropwizard.logging;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.spi.DeferredProcessingAware;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.dropwizard.jackson.Discoverable;
import io.dropwizard.logging.async.AsyncAppenderFactory;
import io.dropwizard.logging.filter.LevelFilterFactory;
import io.dropwizard.logging.layout.LayoutFactory;
/**
* A service provider interface for creating Logback {@link Appender} instances.
*
* To create your own, just:
*
* - Create a class which implements {@link AppenderFactory}.
* - Annotate it with {@code @JsonTypeName} and give it a unique type name.
* - add a {@code META-INF/services/io.dropwizard.logging.AppenderFactory} file with your
* implementation's full class name to the class path.
*
*
* @see ConsoleAppenderFactory
* @see FileAppenderFactory
* @see SyslogAppenderFactory
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
public interface AppenderFactory extends Discoverable {
/**
* Given a Logback context, an application name, a layout,
* a levelFilterFactory, and an asyncAppenderFactory build a new appender.
*
* @param context the Logback context
* @param applicationName the application name
* @param layoutFactory the factory for the layout for logging
* @param levelFilterFactory the factory for the level filter
* @param asyncAppenderFactory the factory for the async appender
* @return a new, started {@link Appender}
*/
Appender build(LoggerContext context,
String applicationName,
LayoutFactory layoutFactory,
LevelFilterFactory levelFilterFactory,
AsyncAppenderFactory asyncAppenderFactory);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy