JEE7: Using Logging with SLF4j


Overview SLf4j logging with jcl-over-slf4j

SLf4j logging with jcl-over-slf4j
Image slf4j_logging_img1.jpg  NOT Found


       <!-- Logging -->

Downloaded External Libraries by MAVEN

  • logback-classic-1.0.13.jar
  • logback-core-1.0.13.jar
  • jcl-over-slf4j-1.7.5.jar
  • slf4j-api-1.7.5.jar

Jee7 Code Sample for SLF4j Logging

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

// The Java class will be hosted at the URI path "/helloworld"
public class HelloWorld {
    private static final Logger LOGGER
            = LoggerFactory.getLogger(HelloWorld.class);

    // The Java method will process HTTP GET requests
    // The Java method will produce content identified by the MIME Media type "text/plain"
    public String getFirstMessage() {" ---- Inside HTTP GET Request --- ");

SLF4j Logger Output [ server.log payara41\glassfish\domains\domain1\logs ]

  10:43:31.058 [http-thread-pool::http-listener-1(4)] INFO  HelloWorld -  ---- Inside HTTP GET Request --- 


Leave a Reply

Your email address will not be published. Required fields are marked *