Microservices Logging Best Practices

Microservice architecture is an application structure that fosters the use of a loosely coupled system to allow you to develop, test, deploy, and release services independently of each other. These services are part of a unique system, and the idea behind using microservices is to break a big problem in smaller problems. Usually, each service interacts with the others through an HTTP endpoint, hiding the details of its technology stack by exposing only a contract to its consumers. Service A will call Service B, which at the same time calls Service C. Once the request chain is complete, Service A might be able to respond to the end customer that initiated the request.

Microservice architecture offers a lot of great benefits like the ability to use different technology stacks, deploy independently, solve small problems one at a time, and more! But using microservices comes with a high cost in that they are complex…not only in how they communicate but also in how to manage them. And they get even more complicated when one or more services fail. Which service failed? Why, and under what circumstances? All these questions are hard to answer if you don’t have good, meaningful logs.

And let’s be honest, we all hate those “unknown” or “something went wrong” system errors. I myself have struggled with the problems that come from a lousy logging strategy. Let me share a few best practices that have helped me when dealing with microservices.

microservices_logging_best_practices

Read More

Log4j2 Configuration: A Detailed Guide to Getting Started

We covered basic logging for Java applications a while back. In that tutorial, we used log4j version 2, a logging framework from the Apache project. Let’s go one step further with Java application logging and look at log4j2 configuration.

Log4j’s capabilities have made it one of Java’s most popular logging frameworks. It can be configured for multiple logging destinations and a variety of log file formats. Log messages can be filtered and directed at the individual class level, giving developers and operations personnel granular control over application messages.

Let’s examine these mechanisms by configuring log4j with a command line Java application.

log4j2_configuration_guide_scalyr

Read More

Get Started Quickly With Spring Boot Logging

Hot on the heels of the Get Started Quickly With Python Logging and Getting Started Quickly With C++ Logging articles, we’re headed across the coffee shop to look at logging in the context of the Java Spring Boot framework. While we’ve written already on the topic of Java logging in Get Started Quickly With Java Logging, the Spring Boot framework simplifies a lot of the plumbing involved in getting up and running. In this article we’ll learn how to:

  • Create a Spring Boot starter project
  • Use Gradle to build our application
  • Configure the default Spring Boot logger
  • Use Log4j2 with Spring Boot
  • Customize the logging configurations

Grab your Venti red-eye triple espresso with almond milk, and let’s get started!spring_boot_logging_scalyr

Read More

Getting Started With the Rails Logger

Let’s continue our ongoing series on getting starting with loggers for different languages and platforms. Back in March, we covered logging with Ruby; now it’s time to take a look at the platform most often associated with that language, Rails.

We’ll start with a simple application with scaffolding for CRUD operations on a single record. We’ll look at Rails’ default logging configuration and how to use logging in an application. Then we’ll look at how logging can be improved and why you might want to improve it.

This tutorial uses Ruby v2.5.1 and Rails 5.2.0. You’ll need to have them installed to follow along. These instructions will use the command line to create and configure the application and will not rely on a specific IDE or editor. We’ll let Rails use SQLite for the backend database.rails_logger_scalyr

Read More

Kubernetes: The Next VMware?

It’s been almost 10 years since VMware started selling ESX version 4.0. This set the path for VMware to dominate more than 75% of the virtualization market in 2017. Gartner considers this market “matured” since most of its revenue comes from maintenance instead of new licensing. Many companies have consolidated their workloads with virtualization, but there are new problems to solve.

Delivering, testing, deploying, and scaling applications are among these challenges. Teams that implement microservices also need to automate as much as possible to make them manageable. Kubernetes, Marathon, Swarm, and Nomad compose a new breed of tools that respond to these needs through orchestration. If you host on-premises or in the cloud, consider them to help your business more quickly deliver code to production.

Companies evolving towards data-driven decision-making often implement machine learning and business intelligence tools, looking for an edge in their markets. As information technology professionals, it’s our responsibility to make sure our businesses select tools that

  • perform in a reliable way;
  • allow quick deployment of new features;
  • scale properly in response to user demand; and
  • deploy new software in a safe and reproducible way.

In this article, I explain why I think Kubernetes is a market leader in the orchestration space and how it might steal VMware’s thunder in the not-so-distant future.

kubernetes_the_next-vmware_scalyr

Read More

Getting Started Quickly With C++ Logging

Since publishing my article Get Started Quickly With Python Logging, I’ve been working on a couple of C++ projects where I’ve found a need for more robust logging solutions than a simple time stamp and message written to a file. Since we also have articles on logging for C# and Java, it made sense to continue the series with an article on C++ logging with Boost.Log. Specifically in this article we are going to:

  • Create a simple Visual Studio 2017 project.
  • Install the Boost libraries using the NuGet package manager.
  • Learn how to configure log output formatting.
  • Add custom attributes to our logger.

This article is a big one, so strap in and let’s get started.

getting_started_quickly_with_c++_logging_scalyr

Read More

Containers and Kubernetes vs VMs vs Config Management

In today’s DevOps-centered world, it’s often easy to be taken in by the infrastructure solution of the hour—VMs for everyone! Or wait, now containers are where it’s at! Who needs config management anyway?

Those of us that are primarily developers probably haven’t had to think about infrastructure decisions as much as our friends on the operations side. Since we haven’t had to make those decisions in the past, it can be hard to figure out what’s out there and why you’d want to use things like VMs or containers. We need to consider what actual problem these solutions are trying to solve. So let’s start simply.

containers_kubernetes_vs_config_management

Read More

Why Do Engineers Care About Logging?

Logging and log analysis are critical to an engineer’s skill set. Engineers rely on logs to track how their systems are running. Sometimes engineers fail to log important events. They often regret not having them in the logs.

See, engineers use logs for error resolution, security, and even for making improvements to the system. Having certain events in the logs and the tools to properly analyze them is what enables engineers to do these things. Let’s look at these ways in which logs are valuable in order to understand more about why engineers care so much about logging.

Scaylr_Engineers_Care_About_Logging_Keyboard

Read More

Getting Started Quickly With Go Logging

It’s time to talk about how to get started with logging again. The languages we’ve covered so far are C#, Java, Python, Ruby, Node.js, and JavaScript. Today, we’re going to be talking about the Go programming language, also known as Golang.

Go is a statically compiled, open-source programming language created by Google in 2009. It runs on Windows, Linux, and Mac and has been increasingly adopted in the last couple of years because of its simplicity and concurrency mechanisms. And in case you didn’t know, Docker and Kubernetes were written in Go.

Go is quite an interesting language when we talk about logging. Why? For one thing, it includes a really simple native library for logging. But the most interesting thing is that in Go there are no exceptions—only errors. That means when you want to log application errors, things get interesting. We’ll cover that later in this post.

But let’s start by taking a look at how easily you can get started logging in Go.

Go Beaver With Scalyr Colors

Read More

Log Analyzer: What It Is and How It Can Help You

A log analyzer allows you to quickly search a specific set of data in a haystack of records. Think of it like bookkeeping. Accounting books tell a story for each transaction made in a period of time. To search through those transactions, you need criteria like the date and amount paid. You find the transaction log and it has more information: payment method, recipient, plus other details.

That’s what a log analyzer does: it helps you find events in a collection so you can study them and fix problems. Here’s an ideal case:

  1. An incident report provides data for log analysis.
  2. Someone reproduces this issue based on your log data.
  3. Your development team proposes a solution in a new fixed app.
  4. Someone reproduces the incident again, this time using your new app.
  5. Log analysis and testing show whether this fix was effective or not.

In this article, I’ll share insights from my experience with log analysis. Read on, draw parallels with your organization, and infer your own conclusions.

Graph with a magnifying glass over it

Read More