public class LoggingAppender
extends ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
Appender configuration in logback.xml:
LoggingEnhancer
classes.
Constructor and Description |
---|
LoggingAppender() |
Modifier and Type | Method and Description |
---|---|
void |
addEnhancer(String enhancerClassName)
Add extra labels using classes that implement
LoggingEnhancer . |
void |
addLoggingEventEnhancer(String enhancerClassName) |
protected void |
append(ch.qos.logback.classic.spi.ILoggingEvent e) |
void |
setCredentialsFile(String credentialsFile)
Sets the credentials file to use to create the
LoggingOptions . |
void |
setFlushLevel(ch.qos.logback.classic.Level flushLevel)
Batched logging requests get immediately flushed for logs at or above this level.
|
void |
setLog(String log)
Sets the log filename.
|
void |
setResourceType(String resourceType)
Sets the name of the monitored resource (Optional).
|
void |
start()
Initialize and configure the cloud logging service.
|
void |
stop() |
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
public void setFlushLevel(ch.qos.logback.classic.Level flushLevel)
Defaults to Error if not set.
flushLevel
- Logback log levelpublic void setLog(String log)
log
- filenamepublic void setResourceType(String resourceType)
Must be a supported resource type. gae_app, gce_instance and container are auto-detected.
Defaults to "global"
resourceType
- name of the monitored resourcepublic void setCredentialsFile(String credentialsFile)
LoggingOptions
. The credentials returned
by GoogleCredentials.getApplicationDefault()
will be used if no custom credentials file
has been set.credentialsFile
- The credentials file to use.public void addEnhancer(String enhancerClassName)
LoggingEnhancer
.public void addLoggingEventEnhancer(String enhancerClassName)
public void start()
start
in interface ch.qos.logback.core.spi.LifeCycle
start
in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
protected void append(ch.qos.logback.classic.spi.ILoggingEvent e)
append
in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
public void stop()
stop
in interface ch.qos.logback.core.spi.LifeCycle
stop
in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
Copyright © 2019 Google LLC. All rights reserved.