addError
.<dependency><groupId>com.tencentcloudapi.cls</groupId><artifactId>tencentcloud-cls-logback-appender</artifactId><version>1.0.3</version></dependency>
<appender name="LoghubAppender" class="com.tencentcloudapi.cls.LoghubAppender"><!--Required--><!--Domain Configuration -- Refer to https://www.tencentcloud.com/document/product/614/18940?lang=en&pg=#domain-name for detailed information.><endpoint><region>.cls.tencentcs.com</endpoint><accessKeyId>${SecretID}</accessKeyId><accessKeySecret>${SecretKey}</accessKeySecret><!--Log Topic ID--><topicId>${topicId}</topicId><!-- Optional. For details, see 'Parameter description'--><totalSizeInBytes>104857600</totalSizeInBytes><maxBlockMs>0</maxBlockMs><sendThreadCount>8</sendThreadCount><batchSizeThresholdInBytes>524288</batchSizeThresholdInBytes><batchCountThreshold>4096</batchCountThreshold><lingerMs>2000</lingerMs><retries>10</retries><baseRetryBackoffMs>100</baseRetryBackoffMs><maxRetryBackoffMs>50000</maxRetryBackoffMs><!-- Optional. Set the time format --><timeFormat>yyyy-MM-dd'T'HH:mm:ssZ</timeFormat><timeZone>Asia/Shanghai</timeZone><encoder><pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg</pattern></encoder><mdcFields>THREAD_ID,MDC_KEY</mdcFields></appender>
Parameter | Description | Example |
totalSizeInBytes | Maximum size of cached logs in a single producer instance. The default value is 100 MB. | totalSizeInBytes=104857600 |
maxBlockMs | If the available space for the producer is insufficient, the maximum blockage time in the send method defaults to 60 seconds. To prevent the obstruction of the log printing thread, it is strongly recommended to set this value to 0. | maxBlockMs=0 |
sendThreadCount | Size of the thread pool for executing log transmission tasks. The default value is the number of available processors. | sendThreadCount=8 |
batchSizeThresholdInBytes | When the size of the cached logs in a ProducerBatch is greater than or equal to the value of the batchSizeThresholdInBytes, the batch will be dispatched. The default value is 512 KB. The maximum value is 5 MB. | batchSizeThresholdInBytes=524288 |
batchCountThreshold | When the number of cached logs in a ProducerBatch is greater than or equal to the value of the batchCountThreshold, the batch will be dispatched. The default value is 4096.The maximum value is 40960. | batchCountThreshold=4096 |
lingerMs | Linger time of a ProducerBatch from creation to dispatch. The default value is 2 seconds. The minimum value is 100 milliseconds. | lingerMs=2000 |
retries | In the event of an initial transmisson failure of a particular ProducerBatch, the default value of the retries is 10. If the value of the retries is less than or equal to 0, the ProducerBatch will directly enter the failure queue following its initial unsuccessful transmission. | retries=10 |
maxReservedAttempts | You will trace back more information when the value of this parameter becomes larger. However, this will also consume more memory. | maxReservedAttempts=11 |
baseRetryBackoffMs | Initial backoff time for the first retry. The default value is 100 milliseconds. The Producer uses an exponential backoff algorithm, where the scheduled waiting time for the Nth retries is calculated as baseRetryBackoffMs * 2^(N-1). | baseRetryBackoffMs=100 |
maxRetryBackoffMs | Maximum backoff time for retries. The default value is 50 seconds. | maxRetryBackoffMs=50000 |
timeFormat | This parameter is used to set the time format. | Accurate to the second: yyyy-MM-dd'T'HH:mm:ssZ
Accurate to the millisecond: yyyy-MM-dd'T'HH:mm:ss.SSSZ |
문제 해결에 도움이 되었나요?