mkauffman

Simple SaaS Logging Tips

Blog Post created by mkauffman on Sep 20, 2016

A recent conversation with a Partner was the impetus for this blog post. We have documentation here on logging here Preparing Your Building Blocks For Learn SaaS. But the Partner asked "In the old days, I would use System.out.println and see the data in stderr-stdout.  Can you suggest how to do something as simple as what I want?" If you long for the good old days there's good news! You can still write log entries to the tomcat stdout-stderr file and then view them in Kibana.

 

Here is an example. I've added the following to a B2's home controller:   System.out.println("springmvcb2 - Is this visible in Kibana? I didn't intentionally log it in the correct format."); Here is a video showing how to find that log entry in Kibana: http://screencast.com/t/tu1m9RO6vNKZ

(For some reason the link to the screencast above is given an odd name by Jive. Ignore that, and click the link.)

 

The code for the B2 is here GitHub - mark-b-kauffman/springmvcb2: demo spring controller to handle requests and copy handler. You will also find in this code example how to set up log4j as discussed here Preparing Your Building Blocks For Learn SaaS. In the code from github you see this line: logger.error("There was NOT an error. This is a test message."); This creates an entry that you can find using Kibana as shown here: http://screencast.com/t/bkFrnVw1PBVG

 

Another good recording on using Kibana to look at logs:   https://www.screencast.com/t/tdw9JCXlzeYF

 

Happy Coding!

 

MBK

Outcomes