Posts tagged "Logging"

Elastic stack: a renewed introduction

Last updated

A few years ago, I had an assignment at my former client involving Elasticsearch, Logstash and Kibana to build an operational dashboard. It was fun to do and very instructive; afterwards, I wrote an article about my experiences and spoke at various conferences. Recently, I was asked by another team in my company to assist them in setting it up for their team. A good chance to catch up with some old friends, and see how they have changed over the years.

Read more... →

Verify logging with Logback

Last updated

Sometimes you have a piece of logging that is very important, maybe even part of a business requirement. In that case, you might want to verify that in a unit test, so you can rest assured that this requirement is actually met. How to do that?

Mock it away

A first approach might be to just mock your logging framework in a unit test and verify it was called as you expected. It might sound tempting, and easy to do, but not everybody likes it. And in fact, you might run into some issues when walking this path, because some libraries tend to make classes and/or methods final so they can’t always be mocked away. Also, a lot of people tend to create a logger by doing private static final Logger LOG = ..., which makes it even harder to mock it away. Making your logger an instance variable just so you can test it? Nah…

Read more... →