Learn more about Streama© – the foundational technology behind our stateful streaming data platform. Learn More

Log4j

To Download Coralogix SDK

See maven repository: http://mvnrepository.com/artifact/com.coralogix.sdk

Install:

Coralogix SDK jar is available on Maven Central Repository

Usage:

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

Company ID – A unique ID that represents your company. The private key can be found under ‘settings’->’ send your logs’. It is located in the upper left corner.

Private Key – A unique ID which represents your company, this Id will be sent to your mail once you register to Coralogix.

Application Name – The name of your main application, for example, a company named “SuperData” would probably insert the “SuperData” string parameter or if they want to debug their test environment they might insert the “SuperData– Test”.

SubSystem Name – Your application probably has multiple subsystems, for example: Backend servers, Middleware, Frontend servers etc. in order to help you examine the data you need, inserting the subsystem parameter is vital.

 

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

CORALOGIX_LOG_URL=https://api.Cluster URL/api/v1/logs

LOG4J-1 appender:


log4j.appender.CORALOGIX=com.coralogix.sdk.appenders.CoralogixLog4j1Appender 
log4j.appender.CORALOGIX.companyId=*insert your company ID* 
log4j.appender.CORALOGIX.privateKey=*Insert your company private key* 
log4j.appender.CORALOGIX.applicationName=*Insert desired Application name* 
log4j.appender.CORALOGIX.subsystemName=*Insert desired Subsystem name* 
log4j.rootLogger=DEBUG, CORALOGIX, YOUR_LOGGER, YOUR_LOGGER2, YOUR_LOGGER3

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

LOG4J-2 APPENDER:


<?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.coralogix.sdk.appenders">
<Appenders>
<Coralogix name="Coralogix" companyId="*insert your company ID*" privateKey="*Insert your company private key*" applicationName="*Insert desired Application name*" subSystemName="*Insert desired Subsystem name*">
</Coralogix>
</Appenders>
<Loggers>
<Root level="trace">
<AppenderRef ref="Coralogix"/>
<AppenderRef ref="YOUR_LOGGER"/>
<AppenderRef ref="YOUR_LOGGER2"/>
</Root>
</Loggers>
</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 book your implementation session, and we will walk you through, step by step.