Skip to content

pmahoney/slf4j-servletcontext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

slf4j-servletcontext

This is a simple logger with minimal configuration. It is an SLF4J backend that forwards logs to a ServletContext object.

Declare a dependency on slf4j-servletcontext:

<dependency>
  <groupId>com.commongroundpublishing</groupId>
  <artifactId>slf4j-servletcontext</artifactId>
  <version>1.0.0</version>
</dependency>

To initialize slf4j-servletcontext, add to web.xml:

<listener>
  <listener-class>com.commongroundpublishing.slf4j.impl.ServletContextLoggerSCL</listener-class>
</listener>

All log messages will now be logged using ServletContext#log.

The logging level can be set with a context parameter. Possible values are (case insensitive) trace, debug, info, warn, error, following the standard slf4j levels.

<context-param>
  <param-name>ServletContextLogger.LEVEL</param-name>
  <param-value>debug</param-value>
</context-param>

About

SLF4J backend to log to a ServletContext

Resources

Stars

Watchers

Forks

Packages

No packages published