Example usage for org.springframework.core.log CompositeLog CompositeLog

List of usage examples for org.springframework.core.log CompositeLog CompositeLog

Introduction

In this page you can find the example usage for org.springframework.core.log CompositeLog CompositeLog.

Prototype

public CompositeLog(List<Log> loggers) 

Source Link

Document

Constructor with list of loggers.

Usage

From source file:org.springframework.core.log.LogDelegateFactory.java

/**
 * Create a composite logger that delegates to a primary or falls back on a
 * secondary logger if logging for the primary logger is not enabled.
 * <p>This may be used for fallback logging from lower level packages that
 * logically should log together with some higher level package but the two
 * don't happen to share a suitable parent package (e.g. logging for the web
 * and lower level http and codec packages). For such cases the primary,
 * class-based logger can be wrapped with a shared fallback logger.
 * @param primaryLogger primary logger to try first
 * @param secondaryLogger secondary logger
 * @param tertiaryLoggers optionally, more fallback loggers
 * @return the resulting logger to use/*  w  ww  .j a  v  a 2 s .c  o m*/
 */
public static Log getCompositeLog(Log primaryLogger, Log secondaryLogger, Log... tertiaryLoggers) {
    List<Log> loggers = new ArrayList<>(2 + tertiaryLoggers.length);
    loggers.add(primaryLogger);
    loggers.add(secondaryLogger);
    Collections.addAll(loggers, tertiaryLoggers);
    return new CompositeLog(loggers);
}