Use LM Log4j appender to export your java application logs to LM platform.
Clone this repository and build the project locally.
./gradlew clean build publishToMavenLocal
We can use LM Log4j Appender by adding dependency in build.gradle file.
dependencies {
implementation 'com.logicmonitor:log4j-appender-logicmonitor:0.0.1-alpha'
}
<dependency>
<groupId>com.logicmonitor</groupId>
<artifactId>log4j-appender-logicmonitor</artifactId>
<version>0.0.1-alpha</version>
</dependency>
Change the log4j2.xml as below
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="com.logicmonitor.log4j2appender">
<Appenders>
<LMAppender name="LmAppender">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</LMAppender>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="LmAppender"/>
</Root>
</Loggers>
</Configuration>
Build the application.
Export the authentication variable.
export LM_COMPANY="<company_name>"
export LM_ACCESS_ID="<accessId>"
export LM_ACCESS_KEY="<accessKey>"
Run the application.