Jelastic Now Has Logentries Support
Jelastic Now Has Logentries Support
Join the DZone community and get the full member experience.Join For Free
We are delighted to announce we have just teamed up with the guys at Jelastic to provide Logentries support for Jelastic users …. and to be perfectly honest we think it's totally Jelastic! Our friends at Jelastic are also excited, so much so they’ve blogged about it too!
With Jelastic’s next generation Java cloud platform, configuring enterprise Java applications ready for production, has been made dead simple. With Jelastic you can deploy your application to the Cloud and be running in minutes instead of hours. Put simply – Upload. Deploy. And Enjoy!
Furthermore, early generation Java cloud computing platforms required developers to manage virtual machines or purpose-build applications to work in the cloud. As anyone who has used Jelastic will know, it is very different because it can pretty much run any Java app without any code changes, it scales vertically and with its choice of app servers and DBs avoids any vendor lock in. As the guys at Jelastic put it: “we just run your code, if you don’t like your Jelastic environment, you can go and run it elsewhere!!!”. On top of that, their UI is super intuitive and allows you to configure and deploy your enterprise java environment … load balancers, application servers, (SQL/NOSQL) DBs …. and all within a few mouse clicks! If you don’t believe us, check out their demo vids on creating and deploying apps in just a few minutes.
Finally if you are worried about latency issues for your end users, or are concerned with where your servers reside, Jelastic is supported by a multiple of hosted service providers: pick the one in your region or with the level of service that you like – it’ s currently hosted in 5 different countries, on 3 continents, in 4 different languages… Considering there are 9 million Java developers in the world its probably just as well
Configuring your Jelastic Environment
The Jelastic UI always gave you access to your different component log files, however now you can stream these logs into a Logentries account where you can take advantage of log visualisation, search, alerts etc. That way, you can quickly get notified if there are any issues in your systems, and figure out the root cause of any problems. You can also store all your Jelastic logs at Logentries for as long as you require, be that for support, business analytics, operations or development purposes.
We have also preconfigured ‘log intelligence’ for Jelastic environments. That mean’s Logentries will automatically format your logs, highlight any exceptions and in certain cases provide information about what these exceptions actually mean for Jelastic users.
Configuring Jelastic with Logentries
Configuring Logentries with Jelastic takes only a few minutes and we have put together a step by step guide on how to do this. In summary it involves the following steps:
- Create a target host in the Logentries UI for your logs
- Create a log file in the Logentries UI for each log file you want to collect log events from in Jelastic
- Downloand and configure the Logentries/Jelastic plugin
- Finally restart your servers and you are good to go. Your logs will appear in Logentries within a few seconds.
Jelastic configured with Logentries
What Jelastic logs should I be looking at and why?
There are lots of logs on Jelastic that you may be interested in looking at, however, it will depend on the environment you have configured. Jelastic allows you to launch a number of different web and application servers and each of these can produce different log files. Here is a short summary of the different server containers and related logs (note the logs in bold tend to be the important ones):
Tomcat uses a logging implementation called JULI internally, which was developed to address some of the shortcomings of the standard logging library shipping with Java (java.util.logging).
Thus Tomcat’s logging capabilities are quite flexible and Tomcat can produce quite a number of log files. Where different events go, can depend on how you configure your logging.properties file and whether you decide to use a logging library or not. For example all stdout and stderr messages are sent to the catalina.out. However, in particular for production systems, its a good idea to use a logging library (e.g. log4j) and to direct log events into application specific logs and not to simply use stdout and lump all log events into a single log file.
On first glance the tomcat logging.properties file can be a bit daunting… for anyone looking to quickly understand this I’d recommend running through the tutorial provided by apache before jumping into the more fine grained details of tomcat logging.
The following logs will be generated when you kick off an instance of Tomcat on Jelastic:
- manager: logs related to the manger application that ships with Tomcat
- localhost_access_log: Captures access request logs
- catalina.out: This file contains log events produced by the tomcat server itself, e.g. during startup, shutdown and any messages produced by the server as it runs and manages the lifecycle of your applications. This log will also cature any stdout and sterr messages from your applications and is often used during development to log errors to.
- host-manager: logs related to the host-manager application that ships with Tomcat
- localhost: Captures any events generated where <Host name=”localhost”>
Similar to Tomcat, Jetty can log via stderr or logging can be controlled using a logging library (slf4j). Slf4j can in fact log to any of the java logging libraries including commons logging, log4j, nlog4j and java logging. Check out the Jetty docs for more details on how to configure their logging infrastructure.
Launching an instance of Jetty on Jelastic will produce two logs from Jetty:
- request: contains any request logs
- stderrout: this is simlar to the catalina.out from Tomcat, insofar as, out of the box it will capture internal server log events, as well as anything sent to stdout and stderr.
With Glassfish 3, each server instance and the domain administration server has an individual server log file. Glassfish logs are covered in a lot of detail on their docs page. Again, similar to Tomcat and Jetty you can make use of logging.properties files and logging libraries to manage logging across your applications. When you kick off Glassfish instances on Jelastic it’s worth keeping an eye on the following logs:
- server_domain: This file contains log events relating to domain administration information. Note on Jelastic this log can regularly produce the exception below – and which can be safely ignored on Jelastic. Note we are building Jelastic specific intelligence into Logentries to give details on errors that you need to look out for, or as is the case with the exception below, that you can safely ignore (stay tuned for this!).
[#|2012-07-10T18:29:36.885+0400|SEVERE|glassfish3.1.1|javax.org.glassfish.gms.org.glassfish.gms|_ThreadID=69;_ThreadName=Thread-3;|GMSAD1017: GMS failed to start. See stack trace for additional information. com.sun.enterprise.ee.cms.core.GMSException: failed to join group gfcluster at com.sun.enterprise.ee.cms.impl.base.GMSContextImpl.join(GMSContextImpl.java:181)
- server_instance: This captures internal server activity as well as your appliction log events and is likely a log you will be interested in keeping an eye on.
Some Example Jelastic Use Cases
Automated alerting for serious errors: Nobody likes null pointer exceptions in their Java apps. However, generally everyone likes to know about these if they are happening, as they can be pretty serious and can lead to fairly catastrophic events in your applications. A great use case for Logentries is to configure alerts for important exceptions such that you get sent an email (or a notification to your smart phone if you prefer) if you ever get serious exceptions. Outofmemory errors are another one you might want to know about, although with outofmemory errors by they time they happen it may be too late Ideally if you can get notified on events that signal something more serious, you can react before something really critical happens.
Creating Alerts on Logentries
Tagging Your Events: Logentries also allows you to highlight events of interest in your logs. So if you’ve just been notified about an issue you can see it immediately in the log graph view, highlighted with a colored tag. Simply click on a tag to get a list of all such events in your logs. You can set up tags for system errors (e.g. exceptions, warnings, errors), or for business events (e.g. payments, signups, logins) or for whatever events are important for you.
Finding and resolving problems: If a new issue raises its ugly head, you may not have a tag set up and it thus may not be highlighted in the log graphs. In this case you may need to start digging for the issue in the log data. If you know roughly when an issue occured you can zoom in on that point in the log graph. Simply select the timeframe in the graph you are interested in to get a more fine grained view, or point and click on a particular point in time in the log graph to get taken directly to that point in the log file.
Interactive Log Graphs
If you know an issue is related to a particular user or IP address, for example, simply use the search bar to search for it. Anyone who can use google (yes thats you can use the search bar, just type in the string you are looking for and Logentries will search for it. For power users, the search bar will also handle regular expressions in case you need to dig for more complex patterns. Once you find and issue don’t forget to create a tag or alert for it so you don’t have to go digging for the same issue again. In fact if you highlight the text in your logs Logentries provides a small pop-up menu for you to do this as soon as you find the problem.
Search and Create Alerts
Finally let us know what you think, and in particular if there are particular Jelastic events that you would like to see highlighted or that you would like to be alerted on out of the box, pleased shout!!
Published at DZone with permission of Trevor Parsons , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.