public class LogbackConfigurationListener extends Object implements ServletContextListener
ServletContextListener that can be used in web applications to load a logback configuration file. This
listener supports logback configuration locations specified either as an absolute file path or as a 'classpath:' URL.| Modifier and Type | Field and Description |
|---|---|
static String |
CLASSPATH_URL_SCHEME
URL scheme used to for classpath URLs.
|
static String |
CONFIG_LOCATION_PARAM
Name of context parameter giving location of logback configuration file.
|
static String |
FILE_URL_SCHEME
URL scheme used to for file URLs.
|
| Constructor and Description |
|---|
LogbackConfigurationListener() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure(ServletContext servletContext,
URL configLocation,
ch.qos.logback.classic.LoggerContext loggerContext)
Configures logback using the given configuration file.
|
void |
contextDestroyed(ServletContextEvent sce) |
void |
contextInitialized(ServletContextEvent sce) |
protected URL |
toURL(ServletContext servletContext,
String location)
Converts the given location in to an absolute URL.
|
public static final String CONFIG_LOCATION_PARAM
public static final String FILE_URL_SCHEME
public static final String CLASSPATH_URL_SCHEME
public void contextInitialized(ServletContextEvent sce)
contextInitialized in interface ServletContextListenerpublic void contextDestroyed(ServletContextEvent sce)
contextDestroyed in interface ServletContextListenerprotected void configure(ServletContext servletContext, URL configLocation, ch.qos.logback.classic.LoggerContext loggerContext)
servletContext - current servlet contextconfigLocation - logback configuration file locationloggerContext - logger context to be configuredprotected URL toURL(ServletContext servletContext, String location)
servletContext - current servlet contextlocation - logback configuration file locationCopyright © 1999–2014. All rights reserved.