Skip to main content

Posts

Showing posts from June, 2022

Log4j : How To Log Message To Console

Introduction This tutorial will help you to log all level messages into console using Log4j plugin. In previous tutorial we have seen how to setup the log4j plugin in Maven and simple logging application. If you need to understand the basic of Log4J the visit previous tutorial. What we will do in this tutorial We saw in the previous tutorial that Log4J's default configuration set the logging level to Error, causing it to log only errors and fatal messages to the console. To overcome this problem, we need to override the default configuration. To do so, we need to write a Log4j configuration file named Log4j2.xml and update the correct logging level.  Log4j supports YAML, JSON, and XML file formats for its configuration files. For this tutorial we are using  Log4j2.xml Sample Log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <Configuration status= "ERROR" > <Appenders> <Console name= "Console" target

Subscribe for latest tutorial updates

* indicates required