public class StaticExternalLog extends Object implements ExternalLog, Configurable, PluginAware
ExternalLog
For implementing the ExternalLog
interface (while being Configurable
), extends this class and implements the getAppender()
and/or getCategory()
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>
Modifier and Type | Field and Description |
---|---|
private boolean |
_additive |
private Appender |
_appender |
private String |
_appenderName |
private String |
_categoryName |
private String |
_filePrefix |
private Level |
_level |
private boolean |
_rollingFileAppender |
protected static Level |
DEFAULT_LEVEL
Default log level
|
protected static String |
PATTERN_LAYOUT
default layout pattern
|
Constructor and Description |
---|
StaticExternalLog() |
Modifier and Type | Method and Description |
---|---|
private FileAppender |
_createFileAppender() |
private org.apache.log4j.rolling.RollingFileAppender |
_createRollingFileAppender() |
void |
configure(Configuration configuration) |
Appender |
getAppender()
Get the appender
|
Logger |
getCategory()
Get or Create a category
|
void |
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. |
protected static final String PATTERN_LAYOUT
protected static final Level DEFAULT_LEVEL
private String _appenderName
private String _categoryName
private String _filePrefix
private boolean _additive
private boolean _rollingFileAppender
public StaticExternalLog()
public Appender getAppender() throws IOException
ExternalLog
getAppender
in interface ExternalLog
IOException
private org.apache.log4j.rolling.RollingFileAppender _createRollingFileAppender()
private FileAppender _createFileAppender() throws IOException
IOException
public Logger getCategory()
ExternalLog
getCategory
in interface ExternalLog
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component