Loupe - Log - Monitor - Resolve
Loupe / Developer's Guide / For Java / Logging / Using other Logging Frameworks / Developer's Guide - Java - Using Loupe with Log4j
In This Topic
    Developer's Guide - Java - Using Loupe with Log4j
    In This Topic

    Adding the Loupe Appender for Log4j

    Add the following dependency to your pom.xml:

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

    Configuring the Loupe Appender

    Then, modify your Log4J configuration to add the appender to the appenders inventory and register it to a scope of your choosing (root to capture everything).  A minimal example is:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration>
     
       <-- Add this line to add the Loupe appender to Log4j -->
       <appender name="LoupeLog4jAppender" class="com.onloupe.appenders.log4j.LoupeLog4jAppender"/>
     
       <-- This registers Loupe to get DEBUG or higher messages for everything>
       <root>
            <level value="DEBUG" />
            <appender-ref ref="LoupeLog4jAppender" />
       </root>
     
    </log4j:configuration>
    
    See Also