Skip to content

com.logicmonitor.log4j-appender-logicmonitor 0.0.01-alpha Latest version

Install 1/2: Add this to pom.xml:
Learn more about Maven or Gradle
<dependency>
  <groupId>com.logicmonitor</groupId>
  <artifactId>log4j-appender-logicmonitor</artifactId>
  <version>0.0.01-alpha</version>
</dependency>
Install 2/2: Run via command line
$ mvn install

About this package

LogicMonitor Log4j appender

You can use log4j-appender-logicmonitor to send log4j logs to LMLogs platform.

Prerequisites

This package is published on GitHub, you need to follow certain steps to fetch/install this. Please follow these steps to setup your project and use this package as a dependency.

Setup a GitHub Personal Access Token

Generate a personal access token for your github account with repo and read:packages scope. Follow these steps

Maven

Step 1: Add Dependency in pom.xml

<dependency>
  <groupId>com.logicmonitor</groupId>
  <artifactId>log4j-appender-logicmonitor</artifactId>
  <version>0.0.01-alpha</version>
</dependency>

Step 2: Configure Maven to use Github repository

<repositories>
  <repository>
    <id>lm-github-repository</id>
    <name>LogicMonitor log4j appender repository</name>
    <url>https://maven.pkg.github.com/logicmonitor/log4j-appender-logicmonitor</url>
  </repository>
</repositories>

Step 3: Add authentication details for repository in USER_HOME/.m2/settings.xml

<servers>
  <server>
    <id>lm-github-repository</id>
    <username>github_username</username>
    <password>github_token</password>
  </server>
</servers>

Gradle

Step 1: In build.gradle, specify below Respository block:

repositories {
    maven {
        credentials {
            username = System.getenv("GITHUB_USERNAME")
            password = System.getenv("GITHUB_TOKEN")
        }
        url "https://maven.pkg.github.com/logicmonitor/log4j-appender-logicmonitor"
    }
    mavenCentral()
}

Set your GITHUB_USERNAME and GITHUB_TOKEN as environment variable.

Step 2: Provide the dependency:

dependencies {
  implementation 'com.logicmonitor:log4j-appender-logicmonitor:0.0.01-alpha'
}

Usage Examples:

Set Configurations

To send logs to your LM portal export the below env variable when you are running the application.

Environment variable Description
LM_COMPANY Account name (Company Name) is your organization name
LM_ACCESS_ID Access id while using LMv1 authentication.
LM_ACCESS_KEY Access key while using LMv1 authentication.