Home » Tag Archives: Logback

Tag Archives: Logback

Logging to Redis using Spring Boot and Logback

redis-logo

When doing centralized logging, e.g. using Elasticsearch, Logstash and Kibana or Graylog2 you have several options available for your Java application. You can either write your standard application logs and parse those using Logstash, either consumed directly or shipped to another machine using something like logstash-forwarder. Alternatively you can write in a more appropriate format like JSON directly so the ...

Read More »

How to Instantly Improve Your Java Logging With 7 Logback Tweaks

logback-logo

The benchmark tests to help you discover how Logback performs under pressure Logging is essential for server-side applications but it comes at a cost. It’s surprising to see though how much impact small changes and configuration tweaks can have on an app’s logging throughput. In this post we will benchmark Logback’s performance in terms of log entries per minute. We’ll ...

Read More »

SiftingAppender: logging different threads to different log files

logback-logo

One novel feature of Logback is SiftingAppender (JavaDoc). In short it’s a proxy appender that creates one child appender per each unique value of a given runtime property. Typically this property is taken from MDC. Here is an example based on the official documentation linked above:               <?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender"> ...

Read More »

Forcing Tomcat to log through SLF4J/Logback

apache-tomcat-logo

So you have your executable web application in JAR with bundled Tomcat (make sure to read that one first). However there are these annoying Tomcat logs at the beginning, independent from our application logs and not customizable:                 Nov 24, 2012 11:44:02 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Nov 24, 2012 11:44:02 ...

Read More »

Logback: Logging revisited

logback-logo

Hi, I am back again with my rant about logging as an inherent part of any application design and development. I am a big fan of strong basics, and in my humble opinion logging is one of those often overlooked but basic critical element of any enterprise grade application. I have written about this before here. This is not really ...

Read More »

JUnit, Logback, Maven with Spring 3

logback-logo

In this series we have already learnt to set up a basic Spring MVC application and learnt how to handle forms in Spring MVC. Now it is time to take on some more involved topics. However, before we venture into deeper waters, let’s get some basics set up. Unit testing I am no TDD evangelist. There I said it. I ...

Read More »

Logback: Application errors notification

logback-logo

Some months ago when I was doing big application refactoring I found really annoying pieces of log4j based code used for logging repeated hundreds of times:                   if (LOG.isDebugEnabled()) { LOG.debug("Logging some stuff = " + stuff); } I wanted to get rid of isXXXEnabled an thats how I found Logback and ...

Read More »

Using slf4j with logback tutorial

logback-logo

In current post I am going to show you how to configure your application to use slf4j and logback as logger solution. The Simple Logging Facade For Java (slf4j) is a simple facade for various logging frameworks, like JDK logging (java.util.logging), log4j, or logback. Even it contains a binding tat will delegate all logger operations to another well known logging ...

Read More »

Filter irrelevant stack trace lines in logs

logback-logo

I love stack traces. Not because I love errors, but the moment they occur, stack trace is priceless source of information. For instance in web application the stack trace shows you the complete request processing path, from HTTP socket, through filters, servlets, controllers, services, DAOs, etc. – up to the place, where an error occurred. You can read them as ...

Read More »

Configure LogBack Logging with Spring

logback-logo

LogBack is an API for logging created by the same author of Log4j (a newer implementation, it is like a new version), during this article I’m going to show how to integrate it and use it on a Spring project. On this tutorial I assume you are using a simple Spring ROO project which will prepare all the structure of ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close