Package com.google.cloud.logging.logback (0.130.8-alpha)

Stay organized with collections Save and categorize content based on your preferences.

Classes

LogbackBatchingSettings

This class is used only to provide batch settings configuration in logback.xml since com.google.api.gax.batching.BatchingSettings cannot be used as is with logback configuration described in https://logback.qos.ch/manual/configuration.html. All data members below are simply copy of com.google.api.gax.batching.BatchingSettings class, so it could be used with logback.xml.

LoggingAppender

Logback appender for Google Cloud Logging.

Appender configuration in logback.xml:

    <appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender">
         <!-- Optional: filter logs at and above this level -->
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>INFO</level>
         </filter>

         <!-- Optional: defaults to "java.log" -->
         <log>application.log</log>

         <!-- Optional: defaults to "ERROR" -->
         <flushLevel>WARN</flushLevel>

         <!-- Optional: defaults to ASYNC -->
         <writeSynchronicity>SYNC</writeSynchronicity>

         <!-- Optional: defaults to true -->
         <autoPopulateMetadata>false</autoPopulateMetadata>

         <!-- Optional: defaults to false -->
         <redirectToStdout>true</redirectToStdout>

         <!-- Optional: auto detects on App Engine Flex, Standard, GCE and GKE, defaults to "global". See supported resource types -->
         <resourceType></resourceType>

         <!-- Optional: defaults to the default credentials of the environment -->
         <credentialsFile>/path/to/credentials/file</credentialsFile>

         <!-- Optional: defaults to the project id obtained during authentication process. Project id is also used to construct resource name of the log entries -->
         <logDestinationProjectId>String</logDestinationProjectId>

         <!-- Optional: add custom labels to log entries using LoggingEnhancer classes -->
         <enhancer>com.example.enhancers.TestLoggingEnhancer</enhancer>
         <enhancer>com.example.enhancers.AnotherEnhancer</enhancer>

         <!-- Optional: specifies if a batch's valid entries should be written even if some other entry failed due to an error. Defaults to true -->
         <partialSuccess>true</partialSuccess>

         <!-- Optional: In the asynchronous mode the call(s) to Logging API takes place asynchronously and few calls to write()
         method may be batched together to compose a single call to Logging API. In order to control the batching settings,
         the logbackBatchingSettings section can be used as shown below.
         See BatchingSettings
         for more info regarding parameters shown below -->
         <logbackBatchingSettings>
            <elementCountThreshold>100</elementCountThreshold>
            <requestByteThreshold>1000</requestByteThreshold>
            <delayThreshold>500</delayThreshold>
            <maxOutstandingElementCount>10000</maxOutstandingElementCount>
            <maxOutstandingRequestBytes>100000</maxOutstandingRequestBytes>
            <limitExceededBehavior>Ignore</limitExceededBehavior>
         </logbackBatchingSettings>
     </appender>
 

TraceLoggingEventEnhancer

Adds support for grouping logs by incoming http request

Interfaces

LoggingEventEnhancer

An enhancer for ILoggingEvent log entries. Used to add custom labels to the LogEntry.Builder.