Package net.shibboleth.idp.log
Class LogbackLoggingService
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
-
- net.shibboleth.utilities.java.support.service.AbstractReloadableService<Object>
-
- net.shibboleth.idp.log.LogbackLoggingService
-
- All Implemented Interfaces:
LoggingService,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent,UnmodifiableComponent,ReloadableService<Object>,Aware,ApplicationContextAware
public class LogbackLoggingService extends AbstractReloadableService<Object> implements LoggingService, ApplicationContextAware
SimpleLoggingServicethat watches for logback configuration file changes and reloads the file when a change occurs.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.shibboleth.utilities.java.support.service.AbstractReloadableService
AbstractReloadableService.ServiceReloadTask
-
-
Field Summary
Fields Modifier and Type Field Description private ApplicationContextapplicationContextSpring application context.private ResourceconfigurationResourceLogging configuration resource.private ResourcefallbackConfigurationURL to the fallback logback configuration found in the IdP jar.private ch.qos.logback.classic.LoggerContextloggerContextLogback logger context.private ch.qos.logback.core.status.StatusManagerstatusManagerLogger used to log messages without relying on the logging system to be full initialized.
-
Constructor Summary
Constructors Constructor Description LogbackLoggingService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoInitialize()protected voiddoReload()ResourcegetLoggingConfiguration()Gets the logging configuration.ServiceableComponent<Object>getServiceableComponent().protected voidloadIdPHomeProperty()Add theIdPPropertiesApplicationContextInitializer.IDP_HOME_PROPERTYproperty from the Spring application context to the logger context.protected voidloadLoggingConfiguration()Reads and loads in a new logging configuration.protected voidloadLoggingConfiguration(InputStream loggingConfig)Loads a logging configuration in to the active logger context.voidsetApplicationContext(ApplicationContext context)voidsetLoggingConfiguration(Resource configuration)Sets the logging configuration.protected booleanshouldReload()-
Methods inherited from class net.shibboleth.utilities.java.support.service.AbstractReloadableService
doDestroy, getLastReloadAttemptInstant, getLastSuccessfulReloadInstant, getLogPrefix, getReloadCheckDelay, getReloadFailureCause, getReloadTaskTimer, isFailFast, reload, setFailFast, setReloadCheckDelay, setReloadTaskTimer
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Methods inherited from interface net.shibboleth.utilities.java.support.service.ReloadableService
getLastReloadAttemptInstant, getLastSuccessfulReloadInstant, getReloadFailureCause, reload
-
-
-
-
Field Detail
-
loggerContext
private ch.qos.logback.classic.LoggerContext loggerContext
Logback logger context.
-
statusManager
private ch.qos.logback.core.status.StatusManager statusManager
Logger used to log messages without relying on the logging system to be full initialized.
-
fallbackConfiguration
@NonnullAfterInit private Resource fallbackConfiguration
URL to the fallback logback configuration found in the IdP jar.
-
configurationResource
@NonnullAfterInit private Resource configurationResource
Logging configuration resource.
-
applicationContext
@Nullable private ApplicationContext applicationContext
Spring application context.
-
-
Method Detail
-
getLoggingConfiguration
@NonnullAfterInit public Resource getLoggingConfiguration()
Gets the logging configuration.- Returns:
- logging configuration
-
setLoggingConfiguration
public void setLoggingConfiguration(@Nonnull Resource configuration)Sets the logging configuration.- Specified by:
setLoggingConfigurationin interfaceLoggingService- Parameters:
configuration- logging configuration
-
setApplicationContext
public void setApplicationContext(ApplicationContext context)
- Specified by:
setApplicationContextin interfaceApplicationContextAware
-
getServiceableComponent
@Nullable public ServiceableComponent<Object> getServiceableComponent()
. This service does not support a ServiceableComponent, so return null.- Specified by:
getServiceableComponentin interfaceReloadableService<Object>
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractReloadableService<Object>- Throws:
ComponentInitializationException
-
shouldReload
protected boolean shouldReload()
- Specified by:
shouldReloadin classAbstractReloadableService<Object>
-
doReload
protected void doReload()
- Overrides:
doReloadin classAbstractReloadableService<Object>
-
loadLoggingConfiguration
protected void loadLoggingConfiguration()
Reads and loads in a new logging configuration.- Throws:
ServiceException- thrown if there is a problem loading the logging configuration
-
loadLoggingConfiguration
protected void loadLoggingConfiguration(InputStream loggingConfig)
Loads a logging configuration in to the active logger context. Error messages are printed out to the status manager.- Parameters:
loggingConfig- logging configuration file- Throws:
ServiceException- thrown is there is a problem loading the logging configuration
-
loadIdPHomeProperty
protected void loadIdPHomeProperty()
Add theIdPPropertiesApplicationContextInitializer.IDP_HOME_PROPERTYproperty from the Spring application context to the logger context.
-
-