To drive business ROI and retain competitive advantage in today’s super-fast paced digital market, organizations have to focus on their applications. Applications are the life-blood of a business; they are the channels through which end-users engage with your brand, products, and services.
Many application servers generate log files in such areas as local files, log4j, log4net, Weblogic, WebSphere, JBoss, .NET, and PHP. All of this IT data provides critical insights into application and application server operation and performance, but also can lead to information on user activity and provide fraud detection. These log files provide an important set of metrics for monitoring your infrastructure when something goes awry. At the same time, the challenge with log files is that there are a “lots” of them and they generate a lot of noise, which can make it difficult to zero in on the exact issues you’re facing.
Java has long been one of the most ubiquitous programming languages out there, and is used as the backbone for many enterprise applications and online businesses. It’s therefore important to be able to track and detect performance bottlenecks and monitor your Java application – such as Java heap memory, threads, and metrics specific to your app – all in real-time in order to detect issues that may impact your customers before they do.
Let’s walk through some “how-tos” on monitoring your Java application logs.
1. Get familiar with Apache Log4j
One of the most powerful Java log engines on the market is Log4J. It’s an open source project now maintained by the Apache Software Foundation. Apache Log4j 2 is the latest upgrade to Log4j.
Monitis has contributed some really helpful articles over the past several years that include plenty of documentation on integrating Log4j into Monitis – so you get the best of both worlds in Java logs monitoring and cloud-based, real-time website monitoring.
Here’s a summary of the methods and approaches adopted in these articles:
This is a great tutorial written four years ago by the founder of Monitis with the aim of building a Monitis Custom monitor that can provide real-time monitoring for Java applications logs. The author maps out the following schema needed to build this system with both Log4J SocketAppender and Monitis Custom Monitoring features.
The source code for implementing this architecture and its necessary details can be found in the GitHub repository here.
In this article the writer shares a simple and easy solution to turn IT logs into useful graphs, in real time. The approach is based on the use of four key tools that he integrates together: Log4J, Logstash (data pipeline & aggregator), StatsD (originally a simple aggregator and summary tool for application metrics, which is now part of DataDog), and Monitis. The writer has this caveat to share, “With so many moving parts, you might be tempted to think this could be an overcomplicated solution. But in fact — as in the long tradition of Unix command line tools — it is a composition of simple tools each doing one job very well. As with files piped from one Unix command to another, these four components act as a pipeline for log events, with each piece adding value to the stream along the way.”
The article is otherwise a very useful tutorial on how to build a fully integrated application log monitoring pipeline from some of the best tools out there, including Monitis.
Written on the heels of the second article above, this third blog shares a more stream-lined approach to monitoring Java application logs. The proposal presented here is to create a generic custom appender with filtering that receives information from Log4J, filters it according to a user pattern (RegExp), and then sends it to Monitis using the Monitis Open API. The writer distills the process down into two simple main steps:
* include the log_mon.jar (generic custom appender) in your list of application libraries
* Using the settings shown below as an example, modify your Log4J configuration file to specify the settings for the Monitis Appender
In many ways this last article represents a simplification of the two earlier approaches.
2. Just use Monitis Java/JMX monitoring!
A lot has happened in the 3 to 4 short years since the preceding articles were written, and Monitis has been busy building newer and easier ways to monitor your Java application logs.
Monitis now provides a simple to install Java/JMX monitoring tool that gives you first hand optics on your whole Java environment. Some of the key features you get here are: frequent health checks on the status of your entire Java application, means to improve code quality, and system stability and performance. Easy to follow instructions for downloading the Java/JMX agent are described here.
Monitis is an industry leading 24/7 cloud-based, monitoring service that provides customers with a clear and intuitive dashboard that lets them see whatever they want in their IT world in a glance. Whether it be Web apps, servers, applications, networks, websites and more, it is all covered in the various monitoring tools that Monitis provides. The benefits and takeaways here are peace of mind and less stress. Knowing about the issues before they strike means you can be proactive rather than reactive. This is good for you and your business, and ultimately leads to better performance and happier customers.
If you’d like to get onboard with the latest in real time and cloud-based website monitoring, then go on over to Monitis today and start a free trial. Let them “keep an eagle eye” on all your Java applications so you can enjoy life and focus on the things that really matter.