March 10, 2020
March 10, 2020
by Daniele Palladino | 3 min read
Application Logging allows the analysis of all or the most critical tasks run by a software and such analysis makes possible improvements of the software and to trace the information related to failures, warnings or simply to perform debugging activities.
There are several libraries and various tools for application logging and the choice usually depends on the programming language. All log libraries have specific configuration (that may be quite simple), yet it takes some expert knowledge and often some experience to learn how to use them effectively.
Microservice architectures make possible to exploit their flexible and scalable stack to optimize application log management by directing logs to any tool used for log storage and analysis. One of these tools is the widely used ELK Stack (Elasticsearch, Logstash and Kibana).
The diagram below represents a microservice architecture showing a possible solution for application logging that leverages the lightweight nature of microservices.
The log management in the example can be implemented using any Advanced Message Queuing (AMQ) broker; in our example we used the open-source RabbitMQ, more specifically, its component called Exchange that allows to route any message towards a specific queue, if tagged appropriately. For example, we can tag individual messages with the expression ‘logger’ and wrap them all in a single queue from which one or more consumer microservices collect the message and stream it to the target ELK system.
The log level can be defined, configuring the consumer microservice which will stream all the logs to the ELK system, following the log hierarchy shown in the figure below.
The implementation above enables efficient log management and it also provides the ability to manage any proprietary log structure eventually required by a customer, even in those many cases when there is already a predefined logging standard in place.
Implementing custom logging, combining microservices and message brokering, offers not just the possibility to reduce development time, software development teams can also lower their maintenance time and costs by more than ninety percent.
Therefore, we can say that Custom Logging allows software development teams to concentrate all their efforts on what matters most: creating and building the best tech for software products and platforms. Happy logging!