Log4J2 | Create Custom Log Levels and How to Use Them

Log4J2 | Create Custom Log Levels and How to Use Them

Yesterday I had the problem, that I needed to log some events of my application in different log styles. So, let's learn how to create, configure and use custom log levels in Log4j2.

Yesterday I had the problem, that I needed to log some events of my application in different log styles (different color, other order of information). I still wanted to use the same logger and didn’t wanna create a new one for each style. How to do that? With custom log levels.

What are log levels?

Log levels are used to differentiate different logs based on their importance. There are already some pretty useful log levels predefined by log4J.

As you see, the higher the number, the more information gets logged. If it is null, nothing will be logged, no matter what log level is used to log. The importance of these log is also based on the intLevel. The higher the more important a log level is. Fatal for example is extremely important and gets logged very rarely.

kotlin

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Hire Dedicated Kotlin Developer - WebClues Infotech

Request a free quote for custom web and mobile apps development, Enterprise solutions, IoT Solutions, AR/VR Development, Blockchain and chatbot services. Feel free to get in touch.

How to Develop an Android App with Kotlin?

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Top Kotlin Android App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Top-notch Kotlin App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Kotlin or React Native | React Native vs Kotlin Performance Comparison

This blog provides quick analysis to decide whether to opt for Kotlin or React Native to build robust and secure mobile application.