Sunday 12 November 2017

Application Logging With JBOSS Logger

Log4j is well known Logger to log all info ,debug related information of application.

While Using Application along with JBoss server we can use JBOSS Logger.

Steps To integrate JBOSS logger to Application

1.Need to include jboss-logging jar in our application.We are using maven project then simply  include the following dependency in POM.

<dependency>
   <groupId>org.jboss.logging</groupId>
   <artifactId>jboss-logging</artifactId>
   <version>3.0.0.CR1</version>
   <scope>provided</scope>
</dependency>
2.Import the following jboss logger package into our class.

import org.jboss.logging.Logger;
3.Create logger object
private static final Logger LOGGER = Logger.getLogger(HelloWorld.class);

4.Finally we can user LOGGER like Log4J

LOGGER.debug(Object message)
LOGGER.info(Object message)
LOGGER.error(Object message)
LOGGER.trace(Object message)
LOGGER.fatal(Object message)


No comments:

Post a Comment