|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.uni_paderborn.fujaba.preferences.AbstractPreferences
de.uni_paderborn.fujaba.preferences.LoggingPreferences
Singleton class containing options for log4j
To use the logging mechanism, create a static variable in your class following this pattern:
private static final Logger L = Logger.getLogger (OptionsLog4J.class);
You now have a log4j Logger (org.apache.log4j.Logger) for your class. Detailed instructions for use can be found on the log4j web site but in general, logging statements will look something like this:
if (L.isDebugEnabled())
{
L.debug ("This is a log statement at debug level");
}
or
if (L.isInfoEnabled())
{
L.info ("This is a log statement at info level");
}
NB The use of the isLEVELEnabled
methods is not required, but prevents log
statements being unnecessarily created if they will not be output as they are at too low
a level. Please refer to the log4j documentation for further information.
Constructor Summary | |
protected |
LoggingPreferences()
The private constructor for this class. |
Method Summary | |
boolean |
configLoaded()
Determines whether the logging configuration has been successfully loaded |
void |
configureLog4J()
Configure log4j according to options stored in this object. |
void |
deleteLogger(java.lang.String name)
Delete a logger from the DOM |
void |
generateTestMsgs()
Generate a message of every level to each logger to test configuration. |
static LoggingPreferences |
get()
This method provides the user the singleton instance of this class. |
java.lang.String |
getAppenderParam(java.lang.String param,
java.lang.String appender)
Gets the value of the parameter param for appender appender |
java.lang.String |
getAppenderPattern(java.lang.String appenderName)
Get the conversion pattern specified for the appender whose settings are contained under appenderNode |
java.util.Collection |
getLoggers()
Get a collection of objects with information on all the loggers contained within the XML file |
LoggerInfo |
getRootLogger()
Gets information about the root logger |
boolean |
isValidLoggerName(java.lang.String name)
Checks a String to see if it is a valid logger name |
void |
loadFile(java.io.File file)
Loads a file of configuration options. |
void |
saveSettings()
Save the current options to user's log4j config file. |
void |
setAppenderParam(java.lang.String param,
java.lang.String value,
java.lang.String appender)
Sets the value of the parameter param for appender appender
to value value |
void |
setAppenderPattern(java.lang.String pattern,
java.lang.String appenderName)
Set the conversion pattern to be used for an appender |
void |
setDefaults()
Set the default options. |
void |
updateLogger(LoggerInfo info)
Update the logger represented by info according to the information in info |
void |
updateRootLogger(LoggerInfo info)
Updates the root logger to correspond to info |
Methods inherited from class de.uni_paderborn.fujaba.preferences.AbstractPreferences |
addPropertyChangeListener, isModified, removePropertyChangeListener, setModified |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected LoggingPreferences()
get()
Method Detail |
public static LoggingPreferences get()
public void setDefaults()
setDefaults
in class AbstractPreferences
public void loadFile(java.io.File file) throws LoggingConfigException
file
- the configuration file
LoggingConfigException
- if there are problems loading the filepublic void configureLog4J()
public void saveSettings()
public void generateTestMsgs()
public boolean isValidLoggerName(java.lang.String name)
name
- the name to check
true
if the name is valid, false
if notpublic boolean configLoaded()
true
if the configuration has been loaded, false
otherwisepublic void updateLogger(LoggerInfo info)
info
according to the information in info
info
- information about the loggerpublic void deleteLogger(java.lang.String name)
name
- the name of the loggerpublic void updateRootLogger(LoggerInfo info)
info
info
- information about the root loggerpublic LoggerInfo getRootLogger()
public java.util.Collection getLoggers()
public java.lang.String getAppenderParam(java.lang.String param, java.lang.String appender)
param
for appender appender
param
- the name of the parameterappender
- the name of the appender
public java.lang.String getAppenderPattern(java.lang.String appenderName)
appenderNode
appenderName
- the name of the appender
public void setAppenderParam(java.lang.String param, java.lang.String value, java.lang.String appender)
param
for appender appender
to value value
param
- the name of the parametervalue
- the value to set the parameter toappender
- the name of the appender which the parameter is forpublic void setAppenderPattern(java.lang.String pattern, java.lang.String appenderName)
pattern
- the pattern to be usedappenderName
- the name of the appender
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |