Class LogDelegateFactory

java.lang.Object
org.springframework.core.log.LogDelegateFactory

public final class LogDelegateFactory extends Object
Factory for common Log delegates with Spring's logging conventions.

Mainly for internal use within the framework with Apache Commons Logging, typically in the form of the spring-jcl bridge but also compatible with other Commons Logging bridges.

Since:
5.1
Author:
Rossen Stoyanchev, Juergen Hoeller
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static Log
    getCompositeLog(Log primaryLogger, Log secondaryLogger, Log... tertiaryLoggers)
    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.
    static Log
    getHiddenLog(Class<?> clazz)
    Create a "hidden" logger with a category name prefixed with "_", thus precluding it from being enabled together with other log categories from the same package.
    static Log
    getHiddenLog(String category)
    Create a "hidden" logger with a category name prefixed with "_", thus precluding it from being enabled together with other log categories from the same package.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCompositeLog

      public static Log getCompositeLog(Log primaryLogger, Log secondaryLogger, Log... tertiaryLoggers)
      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.

      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.

      Parameters:
      primaryLogger - primary logger to try first
      secondaryLogger - secondary logger
      tertiaryLoggers - optional vararg of further fallback loggers
      Returns:
      the resulting composite logger for the related categories
    • getHiddenLog

      public static Log getHiddenLog(Class<?> clazz)
      Create a "hidden" logger with a category name prefixed with "_", thus precluding it from being enabled together with other log categories from the same package. This is useful for specialized output that is either too verbose or otherwise optional or unnecessary to see all the time.
      Parameters:
      clazz - the class for which to create a logger
      Returns:
      a Log with the category "_" + fully-qualified class name
    • getHiddenLog

      public static Log getHiddenLog(String category)
      Create a "hidden" logger with a category name prefixed with "_", thus precluding it from being enabled together with other log categories from the same package. This is useful for specialized output that is either too verbose or otherwise optional or unnecessary to see all the time.
      Parameters:
      category - the log category to use
      Returns:
      a Log with the category "_" + category
      Since:
      5.3.5