Chat Support
Loupe - Log - Monitor - Resolve
Loupe / Developer's Guide / For Java / Logging / Using other Logging Frameworks / Developer's Guide - Java - Using Loupe with Log4j2
Developer's Guide - Java - Using Loupe with Log4j2

Adding the Loupe Appender for Log4j2

Add the following dependency to your pom.xml:

<dependency>
    <groupId>com.onloupe</groupId>
    <artifactId>loupe-log4j2-support</artifactId>
    <version><-- desired version --></version>
</dependency>

Configuring Log4j2

Adding Loupe to Log4j2 is done through the Log4j2 configuration file.  First, add the package path to the Loupe appender to the configuration route:

<Configuration packages="com.onloupe.appenders.log4j">

Next, add the appender to the appenders inventory:

<LoupeLog4jAppender name="Loupe" />

Finally, add the appender to any scope of your choosing.  A complete minimal example is:

<?xml version="1.0" encoding="UTF-8"?>
<!-- add the Loupe package path to the packages attribute -->
<Configuration status="warn" packages="com.onloupe">
    <Appenders>
        <!-- Add Loupe to the appenders list -->
        <LoupeLog4jAppender name="LoupeAppender"/>
    </Appenders>
       <Loggers>
              <Root level="all" additivity="false">
                    <!-- Add Loupe to one or more scopes -->
                    <AppenderRef ref="LoupeAppender" />
              </Root>
       </Loggers>
</Configuration>
See Also