Class AliyunSlsAppender
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
com.elitesland.ystdms.sys.log.provider.logback.appender.AbstractCustomAppender
com.elitesland.ystdms.sys.log.provider.logback.appender.AliyunSlsAppender
- All Implemented Interfaces:
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>,ch.qos.logback.core.spi.ContextAware,ch.qos.logback.core.spi.FilterAttachable<ch.qos.logback.classic.spi.ILoggingEvent>,ch.qos.logback.core.spi.LifeCycle
-
Nested Class Summary
Nested classes/interfaces inherited from class com.elitesland.ystdms.sys.log.provider.logback.appender.AbstractCustomAppender
AbstractCustomAppender.DefaultLayout -
Field Summary
Fields inherited from class com.elitesland.ystdms.sys.log.provider.logback.appender.AbstractCustomAppender
layoutFields inherited from class ch.qos.logback.core.AppenderBase
name, startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription当前appender的名称voidexecuteAppend(ch.qos.logback.classic.spi.ILoggingEvent loggingEvent) 追加日志事件 将日志事件转换为LogItem并放入队列等待异步发送获取SLS服务入口voidsetAccessKeyId(String accessKeyId) 设置AccessKey IDvoidsetAccessKeySecret(String accessKeySecret) 设置AccessKey SecretvoidsetAdjustShardHash(Boolean adjustShardHash) 设置是否需要调整shardHashvoidsetBaseRetryBackoffMs(Integer baseRetryBackoffMs) 设置首次重试的退避时间voidsetBatchCountThreshold(Integer batchCountThreshold) 设置批次数量阈值voidsetBatchSizeThresholdInBytes(Integer batchSizeThresholdInBytes) 设置批次大小阈值voidsetBuckets(Integer buckets) 设置shardHash重新分组的数量voidsetEndpoint(String endpoint) 设置SLS服务入口voidsetIoThreadCount(Integer ioThreadCount) 设置执行日志发送任务的线程池大小voidsetLingerMs(Integer lingerMs) 设置ProducerBatch的逗留时间voidsetLogStore(String logStore) 设置SLS日志库名称voidsetMaxBlockMs(Integer maxBlockMs) 设置调用者在send方法上的最大阻塞时间voidsetMaxReservedAttempts(Integer maxReservedAttempts) 设置最大保留尝试次数voidsetMaxRetryBackoffMs(Integer maxRetryBackoffMs) 设置重试的最大退避时间voidsetProject(String project) 设置SLS项目名称voidsetRetries(Integer retries) 设置重试次数void设置日志来源void设置日志主题voidsetTotalSizeInBytes(Integer totalSizeInBytes) 设置单个Producer实例能缓存的日志大小上限voidstart()启动Appender 初始化配置、创建生产者、启动发送线程voidstop()停止Appender 停止发送线程、关闭生产者、清理资源Methods inherited from class com.elitesland.ystdms.sys.log.provider.logback.appender.AbstractCustomAppender
append, getAppName, getTenantId, getUserId, getUsername, isActive, setActiveAppender, setLayoutMethods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
AliyunSlsAppender
public AliyunSlsAppender()
-
-
Method Details
-
appenderName
Description copied from class:AbstractCustomAppender当前appender的名称可用于判断是否激活
- Specified by:
appenderNamein classAbstractCustomAppender- Returns:
- appender名称
-
start
public void start()启动Appender 初始化配置、创建生产者、启动发送线程- Specified by:
startin interfacech.qos.logback.core.spi.LifeCycle- Overrides:
startin classch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
executeAppend
public void executeAppend(ch.qos.logback.classic.spi.ILoggingEvent loggingEvent) 追加日志事件 将日志事件转换为LogItem并放入队列等待异步发送- Specified by:
executeAppendin classAbstractCustomAppender- Parameters:
loggingEvent- 日志事件
-
stop
public void stop()停止Appender 停止发送线程、关闭生产者、清理资源- Specified by:
stopin interfacech.qos.logback.core.spi.LifeCycle- Overrides:
stopin classch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
getEndpoint
获取SLS服务入口- Returns:
- SLS服务入口地址
-
setEndpoint
设置SLS服务入口- Parameters:
endpoint- SLS服务入口地址
-
setAccessKeyId
设置AccessKey ID- Parameters:
accessKeyId- AccessKey ID
-
setAccessKeySecret
设置AccessKey Secret- Parameters:
accessKeySecret- AccessKey Secret
-
setProject
设置SLS项目名称- Parameters:
project- SLS项目名称
-
setLogStore
设置SLS日志库名称- Parameters:
logStore- SLS日志库名称
-
setTopic
设置日志主题- Parameters:
topic- 日志主题
-
setSource
设置日志来源- Parameters:
source- 日志来源
-
setTotalSizeInBytes
设置单个Producer实例能缓存的日志大小上限- Parameters:
totalSizeInBytes- 缓存大小上限(字节),为null时使用默认值
-
setMaxBlockMs
设置调用者在send方法上的最大阻塞时间- Parameters:
maxBlockMs- 最大阻塞时间(毫秒),为null时使用默认值
-
setIoThreadCount
设置执行日志发送任务的线程池大小- Parameters:
ioThreadCount- 线程池大小,为null时使用默认值
-
setBatchSizeThresholdInBytes
设置批次大小阈值- Parameters:
batchSizeThresholdInBytes- 批次大小阈值(字节),为null时使用默认值
-
setBatchCountThreshold
设置批次数量阈值- Parameters:
batchCountThreshold- 批次数量阈值,为null时使用默认值
-
setLingerMs
设置ProducerBatch的逗留时间- Parameters:
lingerMs- 逗留时间(毫秒),为null时使用默认值
-
setRetries
设置重试次数- Parameters:
retries- 重试次数,为null时使用默认值
-
setMaxReservedAttempts
设置最大保留尝试次数- Parameters:
maxReservedAttempts- 最大保留尝试次数,为null时使用默认值
-
setBaseRetryBackoffMs
设置首次重试的退避时间- Parameters:
baseRetryBackoffMs- 退避时间(毫秒),为null时使用默认值
-
setMaxRetryBackoffMs
设置重试的最大退避时间- Parameters:
maxRetryBackoffMs- 最大退避时间(毫秒),为null时使用默认值
-
setAdjustShardHash
设置是否需要调整shardHash- Parameters:
adjustShardHash- 是否调整shardHash,为null时使用默认值
-
setBuckets
设置shardHash重新分组的数量- Parameters:
buckets- 分组数量,为null时使用默认值
-