|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--java.util.Properties | +--org.jlf.log.LogProperties
LogProperties is a concrete class which manages all of the default
start-up properties for logs. There is only one singleton
instance of this class. The first time the application uses this
class, it will attempt to read its properties from the main application
property file retrieved from the AppInfo
class.
The following property tags and defaults will be used when
reading the log property file:
LogFileExtension = log LogFilePath = c:\\temp\\ LoggingLevel = 4 LoggingMechanism = org.jlf.log.StandardErrLoggingMechanism LogFieldSeparator = |Any of the above property tags can be overridden for a particular log, by prefixing the property key by the log name. Also note that because you may have more than one logging mechanism open for the same log, append a consecutive integer to the property starting at 2. For example:
LogFilePath = /tmp org.jlf.log.AppLog.LoggingLevel = 3 org.jlf.log.AppLog.LoggingMechanism2 = org.jlf.log.fileMechanisms.UniqueDatedFileLoggingMechanism org.jlf.log.AppLog.LoggingMechanism3 = org.jlf.log.smtpMechanism.SMTPLoggingMechanism org.jlf.log.AppLog.LogFieldSeparator = >For the SMTP (mail) logging mechanism, there are global settings for the mail transport as follows:
SMTPHost=mail SMTPUser= SMTPUserPassword=For the SMTP (mail) logging mechanism, there are local log settings to tell what criticality of messages go to which mailboxes (the default is that no messages go anywhere!):
SMTPSendToAddresses.1=level1Support@catapult-technologies.com SMTPMaximumMessageLength=20000 SMTPMessageIntervalInMinutes=5 SMTPMaximumEntriesInMessage=50 org.jlf.log.SQLLog.SMTPSendToAddresses.1=databaseSupport@catapult-technologies.com,level1Support@catapult-technologies.com org.jlf.log.SQLLog.SMTPSendToAddresses.2=databaseSupport@catapult-technologies.comThe above entries would send all level 1 errors for any log with an active SMTPLoggingMechanism to level1Support email box. The SQLLog log would override to send level 1 and 2 errors to the databaseSupport mail box. Messages are sent once every 5 minutes only, with a maximum message length of 20000 characters only and maximum number of log entries in a message 50 (oldest log entries discarded first).
AppInfo
,
Serialized FormField Summary | |
protected static java.lang.String |
DEFAULT_ENTRY_MAX
|
static java.lang.String |
DEFAULT_LOG_FIELD_SEPARATOR
|
static java.lang.String |
DEFAULT_LOG_FILE_EXTENSION
|
static java.lang.String |
DEFAULT_LOG_FILE_PATH
|
static int |
DEFAULT_LOGGING_LEVEL
|
static java.lang.String |
DEFAULT_LOGGING_MECHANISM
|
protected static java.lang.String |
DEFAULT_MESSAGE_INTERVAL_MINUTES
|
protected static java.lang.String |
DEFAULT_SMTP_ADDRESS
|
protected static java.lang.String |
DEFAULT_SMTP_MAX_LENGTH
|
protected static boolean |
initialized
|
protected static java.lang.String |
LOG_FIELD_SEPARATOR_PROPERTY
|
protected static java.lang.String |
LOG_FILE_EXTENSION_PROPERTY
|
protected static java.lang.String |
LOG_FILE_PATH_PROPERTY
|
protected static java.lang.String |
LOGGING_LEVEL_PROPERTY
|
protected static java.lang.String |
LOGGING_MECHANISM_PROPERTY
|
protected static java.lang.String |
PROPERTY_FILE_EXTENSION
|
protected static LogProperties |
singleton
|
protected static java.lang.String |
SMTP_ADDRESSES_PROPERTY
|
protected static java.lang.String |
SMTP_ENTRY_MAX_PROPERTY
|
protected static java.lang.String |
SMTP_MAX_LENGTH_PROPERTY
|
protected static java.lang.String |
SMTP_MESSAGE_INTERVAL_MINUTES_PROPERTY
|
Fields inherited from class java.util.Properties |
defaults |
Constructor Summary | |
LogProperties()
|
Method Summary | |
boolean |
containsLogProperty(Log log,
java.lang.String key)
Checks the property file to see if a property is in the file. |
static LogProperties |
getInstance()
Class accessor (Factory Method) which answers the Singleton instance of the LogProperties for this virtual machine. |
java.lang.String |
getLogFieldSeparator(Log log)
Return the logging level for the log given. |
java.lang.String |
getLoggingExtension(Log log)
Return the file name extension the log file should be written out under. |
int |
getLoggingLevel(Log log)
Return the logging level for the log given. |
java.lang.String |
getLoggingLevelProperty(Log log,
int loggingLevel,
java.lang.String propertyKey,
java.lang.String defaultValue)
Returns an property specific to a logging level, which can be overridden by a specific log. |
java.util.Vector |
getLoggingMechanismNames(Log log)
Return the logging mechanisms for the log given. |
java.lang.String |
getLoggingPath(Log log)
Return the file path the log file should be written out under. |
java.lang.String |
getLogProperty(Log log,
java.lang.String key,
java.lang.String defaultValue)
Returns the default property for the key given by first looking for a property prefixed by the log name. |
long |
getLongLoggingLevelProperty(Log log,
int loggingLevel,
java.lang.String propertyKey,
java.lang.String defaultValue)
Returns an property specific to a logging level, which can be overridden by a specific log. |
java.lang.String |
getSMTPAddresses(Log log,
int loggingLevel)
Returns email address(es) for the log and logging level given as input. |
long |
getSMTPMaximumMessageLength(Log log,
int loggingLevel)
Returns an email address for the log and logging level given as input. |
long |
getSMTPMaxLogEntriesInAMessage(Log log,
int loggingLevel)
Returns the maximum amount of log entries allowed in a particular message. |
long |
getSMTPMessageSendIntervalInMinutes(Log log,
int loggingLevel)
Returns an email address for the log and logging level given as input. |
Methods inherited from class java.util.Properties |
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final java.lang.String PROPERTY_FILE_EXTENSION
protected static final java.lang.String LOG_FILE_PATH_PROPERTY
public static final java.lang.String DEFAULT_LOG_FILE_PATH
protected static final java.lang.String LOG_FILE_EXTENSION_PROPERTY
public static final java.lang.String DEFAULT_LOG_FILE_EXTENSION
protected static final java.lang.String LOGGING_MECHANISM_PROPERTY
public static final java.lang.String DEFAULT_LOGGING_MECHANISM
protected static final java.lang.String LOGGING_LEVEL_PROPERTY
public static final int DEFAULT_LOGGING_LEVEL
protected static final java.lang.String LOG_FIELD_SEPARATOR_PROPERTY
public static final java.lang.String DEFAULT_LOG_FIELD_SEPARATOR
protected static boolean initialized
protected static LogProperties singleton
protected static final java.lang.String SMTP_ADDRESSES_PROPERTY
protected static final java.lang.String DEFAULT_SMTP_ADDRESS
protected static final java.lang.String SMTP_MAX_LENGTH_PROPERTY
protected static final java.lang.String DEFAULT_SMTP_MAX_LENGTH
protected static final java.lang.String SMTP_MESSAGE_INTERVAL_MINUTES_PROPERTY
protected static final java.lang.String DEFAULT_MESSAGE_INTERVAL_MINUTES
protected static final java.lang.String SMTP_ENTRY_MAX_PROPERTY
protected static final java.lang.String DEFAULT_ENTRY_MAX
Constructor Detail |
public LogProperties()
Method Detail |
public static LogProperties getInstance()
public boolean containsLogProperty(Log log, java.lang.String key)
public java.lang.String getLogProperty(Log log, java.lang.String key, java.lang.String defaultValue)
public java.lang.String getLoggingPath(Log log)
public java.lang.String getLoggingExtension(Log log)
public java.util.Vector getLoggingMechanismNames(Log log)
public int getLoggingLevel(Log log)
public java.lang.String getLogFieldSeparator(Log log)
public java.lang.String getLoggingLevelProperty(Log log, int loggingLevel, java.lang.String propertyKey, java.lang.String defaultValue)
public long getLongLoggingLevelProperty(Log log, int loggingLevel, java.lang.String propertyKey, java.lang.String defaultValue)
public java.lang.String getSMTPAddresses(Log log, int loggingLevel)
public long getSMTPMaximumMessageLength(Log log, int loggingLevel)
public long getSMTPMessageSendIntervalInMinutes(Log log, int loggingLevel)
public long getSMTPMaxLogEntriesInAMessage(Log log, int loggingLevel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |