We're launching a new cybersecurity venture! Learn more about Snowbit >

Logback Logback

Last Updated: Mar. 30, 2022

Appenders are nice, and they help take our logging standard to a whole new level.
In this section we will explain how you can integrate Logback with Coralogix Java SDK.

Requirements:

You need to have the Coralogix Java SDK integrated into your project.
Read all about it, Here.

Usage:

You must provide the following four variables when creating a Coralogix logger instance.

ParameterDescription
Private KeyThe private key can be found under ‘settings’->’ send your logs’.
Company IDA unique ID that represents your company.
The private key can be found under ‘settings’->’ send your logs’.
Application NameThe application Tag you wish to append to every log line sent
SubSystem NameThe subsystem Tag you wish to append to every log line sent

If your Coralogix account top-level domain is not ‘.com’ set the following environment variables:

CORALOGIX_LOG_URL=https://<coralogix_cluster_url>/api/v1/logs
Cluster locationcoralogix_cluster_url
USapi.coralogix.us
Indiaapi.app.coralogix.in
Singaporeapi.coralogixsg.com

Below are Code examples to demonstrate how to add the appender

Logback appender:

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration debug=”true”>
<appender name=”coralogix” class=”com.coralogix.sdk.appenders.CoralogixLogbackAppender”>
<companyId>*insert your company ID*</companyId>
<privateKey>*Insert your company private key*</privateKey>
<applicationName>*Insert desired Application name*</applicationName>
<subsystemName>*Insert desired Subsystem name*</subsystemName>
<mdc>firstKeyName,secondKeyName,thirdKeyName</mdc> *optional field*
</appender>
<root level=”debug”>
<appender-ref ref=”coralogix”/>
<appender-ref ref=”YOUR_LOGGER”/>
<appender-ref ref=”YOUR_LOGGER2″/>
</root>
</configuration>

Note!: YOUR_LOGGER is another logger you have defined in your log4j configuration that you want to be defined on the rootLogger

Need help? We love to assist our customers, simply reach out via our in-app chat, and we will walk you through, step by step.

On this page