Class DefaultPlatform


  • public class DefaultPlatform
    extends com.google.common.flogger.backend.Platform
    The default fluent logger platform for a server-side Java environment.

    This class allows configuration via a number of service types. A single instance of each service type may be provided, either via the classpath using service providers (see ServiceLoader) or by system property. For most users, configuring one of these should just require including the appropriate dependency.

    If set, the system property for each service type takes precedence over any implementations that may be found on the classpath. The value of the system property is expected to be of one of two forms:

    • A fully-qualified class name: In this case, the platform will attempt to get an instance of that class by invoking the public no-arg constructor. If the class defines a public static no-arg getInstance method, the platform will call that instead. Note: Support for getInstance is only provided to facilitate transition from older service implementations that include a getInstance method and will likely be removed in the future.
    • A fully-qualified class name followed by "#" and the name of a static method: In this case, the platform will attempt to get an instance of that class by invoking either the named no-arg static method or the public no-arg constructor. Note: This option exists only for compatibility with previous Flogger behavior and may be removed in the future; service implementations should prefer providing a no-arg public constructor rather than a static method and system properties should prefer only including the class name.

    The services used by this platform are the following:

    Service Type System Property Default
    BackendFactory flogger.backend_factory SimpleBackendFactory, a java.util.logging backend
    ContextDataProvider flogger.logging_context A no-op ContextDataProvider
    Clock flogger.clock SystemClock, a millisecond-precision clock
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.common.flogger.backend.Platform

        com.google.common.flogger.backend.Platform.LogCallerFinder
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultPlatform()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected com.google.common.flogger.backend.LoggerBackend getBackendImpl​(java.lang.String className)  
      protected com.google.common.flogger.backend.Platform.LogCallerFinder getCallerFinderImpl()  
      protected java.lang.String getConfigInfoImpl()  
      protected com.google.common.flogger.context.ContextDataProvider getContextDataProviderImpl()  
      protected long getCurrentTimeNanosImpl()  
      • Methods inherited from class com.google.common.flogger.backend.Platform

        getBackend, getCallerFinder, getConfigInfo, getContextDataProvider, getCurrentRecursionDepth, getCurrentTimeNanos, getInjectedMetadata, getInjectedTags, shouldForceLogging
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultPlatform

        public DefaultPlatform()
    • Method Detail

      • getCallerFinderImpl

        protected com.google.common.flogger.backend.Platform.LogCallerFinder getCallerFinderImpl()
        Specified by:
        getCallerFinderImpl in class com.google.common.flogger.backend.Platform
      • getBackendImpl

        protected com.google.common.flogger.backend.LoggerBackend getBackendImpl​(java.lang.String className)
        Specified by:
        getBackendImpl in class com.google.common.flogger.backend.Platform
      • getContextDataProviderImpl

        protected com.google.common.flogger.context.ContextDataProvider getContextDataProviderImpl()
        Overrides:
        getContextDataProviderImpl in class com.google.common.flogger.backend.Platform
      • getCurrentTimeNanosImpl

        protected long getCurrentTimeNanosImpl()
        Overrides:
        getCurrentTimeNanosImpl in class com.google.common.flogger.backend.Platform
      • getConfigInfoImpl

        protected java.lang.String getConfigInfoImpl()
        Specified by:
        getConfigInfoImpl in class com.google.common.flogger.backend.Platform