tencent cloud


Uploading Logs via Logback Appender

Last updated: 2022-11-15 15:02:17


    Currently, CLS allows you to upload logs to CLS by using Logback Appender.


    Logback is an open source project of Apache. Logback allows you to deliver logs to various destinations, including consoles, files, GUI components, and even socket servers, NT event loggers, and UNIX Syslog daemons. In addition, you can have the flexibility to configure the logging behavior by editing a configuration file without modifying the application code.


    • Logs are not stored on disks: generated log data is delivered to servers via the network.
    • No reconstruction is required: for applications that are using Logback, you only need to perform simple configuration to enable log collection.
    • Logs are delivered in async non-blocking mode: the high concurrency and backend async delivery design make Logback ideal for high write concurrency.
    • Resources are controllable: you can use parameters to control the size of the memory used by the producer to cache data to be sent and the number of threads used to execute data sending tasks.
    • Automatic retries: you can configure the number of retries for exceptions that allow retries.
    • Graceful shutdown: Logback will deliver logs in full mode before exiting.
    • Log reporting result response: exceptions that occur during Logback running are output via addError.

    Project Introduction and Configuration

    Introducing dependencies into a Maven project


    Modifying the Logback configuration file

     <appender name="LoghubAppender" class="com.tencentcloudapi.cls.LoghubAppender">
            <!-- Optional. For details, see 'Parameter description'-->
            <!-- Optional. Set the time format -->
               <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg</pattern>

    Logback Appender SDK

    Please use tencentcloud-cls-logback-appender.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support