Class ComponentBase
java.lang.Object
org.apache.log4j.component.spi.ComponentBase
- All Implemented Interfaces:
Component
- Direct Known Subclasses:
ConnectionSourceSkeleton, DBReceiverJob, PluginSkeleton, SocketNode13, Util, XMLSocketNode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intError count limit.private intError count.private ULoggerLogger.protected org.apache.log4j.spi.LoggerRepositoryLogger repository. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ULoggerReturn an instance specific logger to be used by the component itself.protected org.apache.log4j.spi.LoggerRepositoryReturn the LoggerRepository to which this component is attached.protected ULoggerFrequently called methods in log4j components can invoke this method in order to avoid flooding the output when logging lasting error conditions.protected voidCalled by derived classes when they deem that the component has recovered from an erroneous state.voidsetLoggerRepository(org.apache.log4j.spi.LoggerRepository repository) Set the owning repository.
-
Field Details
-
ERROR_COUNT_LIMIT
private static final int ERROR_COUNT_LIMITError count limit.- See Also:
-
repository
protected org.apache.log4j.spi.LoggerRepository repositoryLogger repository. -
logger
Logger. -
errorCount
private int errorCountError count.
-
-
Constructor Details
-
ComponentBase
protected ComponentBase()Construct a new instance.
-
-
Method Details
-
resetErrorCount
protected void resetErrorCount()Called by derived classes when they deem that the component has recovered from an erroneous state. -
setLoggerRepository
public void setLoggerRepository(org.apache.log4j.spi.LoggerRepository repository) Set the owning repository. The owning repository cannot be set more than once.- Specified by:
setLoggerRepositoryin interfaceComponent- Parameters:
repository- repository
-
getLoggerRepository
protected org.apache.log4j.spi.LoggerRepository getLoggerRepository()Return the LoggerRepository to which this component is attached.- Returns:
- Owning LoggerRepository
-
getLogger
Return an instance specific logger to be used by the component itself. This logger is not intended to be accessed by the end-user, hence the protected keyword.In case the repository for this component is not set, this implementations returns a
SimpleULoggerinstance.- Returns:
- A ULogger instance.
-
getNonFloodingLogger
Frequently called methods in log4j components can invoke this method in order to avoid flooding the output when logging lasting error conditions.- Returns:
- a regular logger, or a NOPLogger if called too frequently.
-