Package org.ametys.runtime.log
Class StaticExternalLog
- java.lang.Object
-
- org.ametys.runtime.log.StaticExternalLog
-
- All Implemented Interfaces:
ExternalLog
,PluginAware
,Configurable
public class StaticExternalLog extends Object implements ExternalLog, Configurable, PluginAware
Default static implementation ofExternalLog
For implementing theExternalLog
interface (while beingConfigurable
), extends this class and implements thegetAppender()
and/orgetCategory()
methods. Example of XML<extension id="runtime.core.externalLogger.myTest" class="org.ametys.runtime.log.StaticExternalLog" point="org.ametys.runtime.log.ExternalLogExtensionPoint"> <appender-name>my-logger</appender-name> <category-name>com.example.mylog</category-name> <file-prefix>my-file-name</file-prefix> <additive>false</additive> <rolling-file>true</rolling-file> <log-level>INFO</log-level> </extension>
-
-
Field Summary
Fields Modifier and Type Field Description protected static Level
DEFAULT_LEVEL
Default log levelprotected static String
PATTERN_LAYOUT
default layout pattern
-
Constructor Summary
Constructors Constructor Description StaticExternalLog()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Configuration configuration)
Appender
getAppender()
Get the appenderLogger
getCategory()
Get or Create a categoryvoid
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.
-
-
-
Field Detail
-
PATTERN_LAYOUT
protected static final String PATTERN_LAYOUT
default layout pattern- See Also:
- Constant Field Values
-
DEFAULT_LEVEL
protected static final Level DEFAULT_LEVEL
Default log level
-
-
Constructor Detail
-
StaticExternalLog
public StaticExternalLog()
-
-
Method Detail
-
getAppender
public Appender getAppender() throws IOException
Description copied from interface:ExternalLog
Get the appender- Specified by:
getAppender
in interfaceExternalLog
- Returns:
- an appender that can be added to a category
- Throws:
IOException
-
getCategory
public Logger getCategory()
Description copied from interface:ExternalLog
Get or Create a category- Specified by:
getCategory
in interfaceExternalLog
- Returns:
- a category from logManager
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
-