Loupe Captures Logging for Java Apps
We recently announced the new Loupe Agent for Java - a full-featured telemetry framework for Java applications, compatible with Loupe.
Like the rest of Loupe’s agents, the Loupe Agent for Java has an Open Source license and is available on GitHub. It’s also available as a Maven package, which is the preferred way to incorporate it into your Java application. All build platforms supported by The Central Repository are equally applicable to Loupe. For more information on getting started with Loupe, refer to our Developer’s Guide for Java.
Brewed for the every day cup of Java
The Java community offers a robust ecosystem of frameworks, open source technologies, and tool kits for logging and monitoring. We knew from the start that supporting the mainstay of these technologies is vital to the Loupe Java agent’s ability to deliver value. Therefore, in addition to direct usage of Loupe through an API, we offer appenders for the following:
- Log4j
- Log4j2
- Logback
By providing appenders that support these frameworks, Loupe gains deep and broad awareness of the activity within your application and it’s dependencies.
A Simple Sample
The reigning gold standard, Apache’s Log4j platform, was a critical integration. Imagine that you have a a simple Spring Boot application and want to integrate Loupe with it.
Our appender is readily available via Maven with all of the underlying Loupe technology:
<dependency>
<groupId>com.onloupe</groupId>
<artifactId>loupe-log4j2-support</artifactId>
<version>1.0.1</version>
</dependency>
From there, integrating Loupe is simple with log4j2.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" packages="com.onloupe">
<Appenders>
<LoupeLog4jAppender name="LoupeAppender"/>
</Appenders>
<Loggers>
<Root level="all" additivity="false">
<AppenderRef ref="LoupeAppender" />
</Root>
</Loggers>
</Configuration>
Note that the packages must include com.onloupe to detect our appender.
And, voila!
Note that the logging of both Spring AND Hibernate is being captured by Loupe. This is because of our direct integration via Log4j.
More Than Just Logging
Loupe also offers insight into the host environment, classpath dependencies and the session itself.
In the case of logging frameworks, Loupe will attempt to delegate lifecycle management to that framework via its appender. That means it will start with the logging framework(s) and shut down with them. If multiple frameworks are all sending information to Loupe, it will start with the first and shut down with the last one so you have complete end-to-end coverage.
Get Started with Loupe Today
Take advantage of Loupe’s excellent log and telemetry viewer for Java, all for free - [get started with Loupe today!]((/local-logging/free-net-log-viewer)