Skip to main content
All CollectionsSend your logs
Coralogix JAVA integration
Coralogix JAVA integration

Integrate your Java logs into Coralogix using our SDK

Eldar Aliiev avatar
Written by Eldar Aliiev
Updated over a year ago

To download the 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 private key which is used to validate your authenticity, this key will be sent to your mail once you register to Coralogix and should not be transferred outside your company.

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.

Example (for SDK versions 2.x):

import api.CoralogixLogger;

public class logging {

    public static void main(String[] args) {

        String privateKey = "*insert the private key you received after signup*";
        String appName = "*Insert desired Application name*";
        String subSystem = "*Insert desired subsystem name*";

        //set only once for application
        CoralogixLogger.configure(privateKey, appName, subSystem);


        CoralogixLogger logger = new CoralogixLogger(logging.class.toString());

        logger.info("my info log");
    }
}

Example (for SDK versions 1.x):

import com.coralogix.sdk.api.CoralogixLogger;
import com.coralogix.sdk.api.CoralogixSDK;

public class logging {
    public static void main(String[] args) throws Exception{

        String privateKey = "*insert the private key you received after signup*";
        int companyId = "*insert the company ID you received after signup*";
        String appName = *companyId* + "*Insert desired Application name*";
        String subsystem = "*Insert desired subsystem name*";

        CoralogixLogger logger = CoralogixSDK.createAndConnectNewLogger(appName, subsystem, companyId, privateKey);
        logger.sendCriticalLog("This is my serious test log 1");
        logger.sendCriticalLog("This is my serious test log 2");

    }
}
Did this answer your question?