Chat Support
Loupe - Log - Monitor - Resolve
Loupe / Getting Started / Developer's Guide - Java -Using Loupe with Java
In This Topic
    Developer's Guide - Java -Using Loupe with Java
    In This Topic
     Adding Loupe to your Application

    Add the following dependency to your pom.xml:

        <version><-- desired version --></version>

    Then rebuild your application to incorporate the agent into your application. With just the core agent you can record metrics and capture diagnostic information about your application.

     Adding Loupe Appenders for Other Logging Frameworks

    Loupe includes support for many of the most popular Java logging frameworks.  If you're using any of these (or using a dependency that does) just add the necessary appender. For more details, see Developer's Guide - Java - Using Loupe with other Logging Frameworks

     Configuring Loupe

    The Loupe Agent needs a minimal configuration to identify the application, set the logging folder, and connect to a Loupe Server.

    Once you've instrumented an application you'll want to set up a connection with Loupe Server so you can collect data from everywhere your application runs and start managing errors.  You'll need to make a few changes to the configuration examples below to have them work:

    • Replace "Your Loupe Service Name" with the name of your Loupe Cloud-hosted Service.  If you don't have one yet, sign up for a free trial service.
    • Replace "Your Product" and "Your Application" with friendly values for your application.  A good analogy for Product is "Office" and Application is "Word", "Excel", and "PowerPoint". 

    Configuration via Properties File

    Loupe can also be configured using properties files - for the name/value pair text properties format and loupe.xml for the XML file format. The properties file need only be placed on the classpath, and Loupe will detect and utilize it.

    Publisher.ProductName=Your Product
    Publisher.ApplicationName=Your Application
    Server.CustomerName=Your Loupe Service Name
    <!DOCTYPE properties SYSTEM "">
        <entry key="Publisher.ProductName">Your Product</entry>
        <entry key="Publisher.ApplicationName">Your Application</entry>
        <entry key="Publisher.ApplicationVersion">1.0.0</entry>
        <entry key="Server.UseGibraltarService">true</entry>
        <entry key="Server.CustomerName">Your Loupe Service Name</entry>
        <entry key="Server.AutoSendSessions">true</entry>
        <entry key="Server.SendAllApplications">true</entry>

    Configuration via Code

    Loupe can be configured directly using its configuration object, for example:

    AgentConfiguration configuration = AgentConfiguration.builder()
            .productName("Your Product")
            .applicationName("Your Application")
            .applicationVersion(new Version(1, 0, 0)).build())
            .customerName("Your Loupe Service Name")

    The configuration object can then be injected in an explicit call to start Loupe:


    Or, if using the loupe-api package:


    For details on all of the configuration options, see <link to Java Configuration>

     Log File Locations

    You may define which directory Loupe will use to store log files (.glf) by defining the following property:

    SessionFile.Folder=<fully qualified path>

    If this value is undefined, Loupe will attempt to place log files in the most sensible location available based on the state of the host operating system.

    Log Path on Windows

    First, Loupe will attempt to use the common application data folder:

    C:\ProgramData\Gibraltar\Local Logs

    If the common application data folder is unavailable, the local data folder will be attempted:

    C:\Users\<user name>\AppData\Gibraltar\Local Logs

    Failing both of these, the Java tmp io directory will be used.

    Log Path on Linux

    First, Loupe will attempt to use the common logging area:

    /var/log/Gibraltar/Local Logs

    By default, this folder is generally not available for write operations by users outside of it's group. This will need to be handled accordingly when provisioning the user running the Loupe agent or appenders.

    Otherwise, Loupe will attempt to use a hidden folder in the user home directory:

    /home/<user name>/.logs/Gibraltar/Local Logs

    Failing both of these, the Java tmp io directory will be used.

    See Also