Class DefaultPlatform


  • public class DefaultPlatform
    extends com.google.common.flogger.backend.Platform
    The default fluent logger platform for a server-side Java environment. The default platform implements the following behavior:
    • It generates SimpleLoggerBackend logger backends.
    • It uses a default clock implementation (only millisecond precision until Java 8).
    • It does not provide support for injecting additional metadata into log statements.
    • It determines call site information via stack analysis.

    This class is designed to allow configuration via system properties. Each aspect of the platform is configured by providing the name of a static method, in the form "<package>.<class>#<method>", which returns an instance of the appropriate type. The namespace for system properties is:

    • flogger.backend_factory: Provides an instance of com.google.common.flogger.backend.system.BackendFactory.
    • flogger.logging_context: Provides an instance of com.google.common.flogger.context.ContextDataProvider.
    • flogger.clock: Provides an instance of com.google.common.flogger.backend.system.Clock.

    Note that if the com.google.flogger:flogger-grpc-context is also available and the value of the flogger.logging_context system property is "com.google.common.flogger.grpc.GrpcContextDataProvider#getInstance" then a gRPC based implementation of the ScopedLoggingContext API will be used.

    • 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, 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