|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sap.ip.me.api.logging.AbstractLogging
This abstract class contains a set of pre implemented methods for logging.
It is the parent for the Mobile Infrastructure Trace
and AppLog
.
Field Summary | |
protected static java.lang.String |
CONFIGURATION_PREFIX
The prefix for all Mobile Infrastructure log configurations. |
protected static java.lang.String |
LOG_ENABLED_SUFFIX
The enabled suffix of a Mobile Infrastructure log configuration. |
protected static java.lang.String |
LOG_LEVEL_SUFFIX
The log level suffix of a Mobile Infrastructure log configuration. |
protected static java.lang.String |
LOGWRITER_IMPLEMENTATION_SUFFIX
The suffix for the configuration of the implementation class of the log writer. |
Constructor Summary | |
AbstractLogging()
|
Method Summary | |
java.lang.String |
getComponent()
Gets the component name for this log instance. |
abstract int |
getEffectiveSeverity()
Gets the current log level of the log |
java.io.InputStream |
getLogContentAsStream()
Returns an input stream with the log content. |
protected java.lang.String |
getLogLevelName(int logLevel)
Gets the logLevelName attribute of the AbstractLogging object |
protected abstract LogWriter |
getLogWriter()
Returns the LogWriter instance of this log. |
protected abstract java.lang.String |
getLogWriterClassname()
Gets the configured filename / path of the log. |
java.io.Writer |
getWriter(int severity,
java.lang.String message)
Writes a given message to trace (with prefix "Start: ") and returns current log writer. |
abstract boolean |
isLogging(int severity)
Returns true iff the given log severity will be logged. |
abstract boolean |
isOn()
Gets the current activation state of the log. |
void |
log(int severity,
java.lang.String message)
Logs the message if log is switched on and the given severity will be logged. |
void |
log(int severity,
java.lang.String message,
java.lang.Object param)
Logs the message if log is switched on and the given severity will be logged. |
void |
log(int severity,
java.lang.String message,
java.lang.Object[] params)
Logs the message if log is switched on and the given severity will be logged. |
void |
log(int severity,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2)
Logs the message if log is switched on and the given severity will be logged. |
void |
log(int severity,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2,
java.lang.Object param3)
Logs the message if log is switched on and the given severity will be logged. |
void |
log(java.lang.String message)
Logs the message if log is switched on and severity INFO_LEVEL
will be logged. |
void |
log(java.lang.String message,
java.lang.Object param1)
Logs the message if log is switched on and severity INFO_LEVEL
will be logged. |
void |
log(java.lang.String message,
java.lang.Object[] params)
Logs the message if log is switched on and severity INFO_LEVEL
will be logged. |
void |
log(java.lang.String message,
java.lang.Object param1,
java.lang.Object param2)
Logs the message if log is switched on and severity INFO_LEVEL
will be logged. |
void |
log(java.lang.String message,
java.lang.Object param1,
java.lang.Object param2,
java.lang.Object param3)
Logs the message if log is switched on and severity INFO_LEVEL
will be logged. |
void |
logException(int severity,
java.lang.String message,
java.lang.Object[] params,
java.lang.Throwable t,
boolean printStackTrace)
Logs an Exception with the given message if log is switched on. |
void |
logException(int severity,
java.lang.String message,
java.lang.Throwable t,
boolean printStackTrace)
Logs an Exception with the given message if log is switched on. |
void |
logException(int severity,
java.lang.Throwable t)
Logs an Exception without any additional message if log is switched on. |
void |
logException(int severity,
java.lang.Throwable t,
boolean printStackTrace)
Logs an Exception without any additional message if log is switched on. |
void |
logException(java.lang.String message,
java.lang.Throwable t,
boolean printStackTrace)
Logs an Exception with the given message if log is switched on. |
void |
logException(java.lang.Throwable t)
Logs an Exception without any additional message if log is switched on. |
void |
logException(java.lang.Throwable t,
boolean printStackTrace)
Logs an Exception without any additional message if log is switched on. |
void |
logFileContent(int severity,
java.io.File file)
Logs the content of a file into the log file if log is switched on and the trace level is less or equal the current trace level. |
void |
logFileContent(int severity,
java.io.File file,
java.lang.String encoding)
Logs the content of a file into the log file if log is switched on and the trace level is less or equal the current trace level. |
java.util.Vector |
read()
Reads the trace file and returns an String - Enumeration of
the log file lines. |
protected abstract void |
readConfiguration(java.lang.String logName)
Reads the configuration for the given log. |
abstract void |
refresh()
Do not use this method. |
void |
releaseWriter(int severity,
java.lang.String message)
Writes a given message to trace (with prefix "End: ") and updates internal status. |
void |
reset()
Resets the log. |
protected void |
setComponent(java.lang.String componentname)
Sets the component name for this instance. |
abstract void |
setEffectiveSeverity(int severity)
Gets the current log level of the log |
protected abstract void |
setLogWriter(LogWriter newLogWriter)
Sets the LogWriter instance. |
protected abstract void |
setOn(boolean on)
Sets the current activation state of the log. |
abstract boolean |
switchOn(boolean on)
Turns the log on or off. |
protected void |
writeConfiguration(java.lang.String logName,
boolean userdependant)
Writes the configuration for the given log. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String CONFIGURATION_PREFIX
protected static final java.lang.String LOG_ENABLED_SUFFIX
protected static final java.lang.String LOG_LEVEL_SUFFIX
protected static final java.lang.String LOGWRITER_IMPLEMENTATION_SUFFIX
Constructor Detail |
public AbstractLogging()
Method Detail |
public final void logFileContent(int severity, java.io.File file)
severity
- The severity for this message.file
- The file that has to be logged.public void log(int severity, java.lang.String message)
severity
- The severity for this message.message
- The message that has to be logged.public void log(int severity, java.lang.String message, java.lang.Object param)
severity
- The severity for this message.message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.param
- The parameter for the message. See java.text.MessageFormat
.for further details.
public void log(int severity, java.lang.String message, java.lang.Object param1, java.lang.Object param2)
severity
- The severity for this message.message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.param1
- The first parameter for the message. See java.text.MessageFormat
.param2
- The second parameter for the message. See java.text.MessageFormat
.for further details.
public void log(int severity, java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
severity
- The severity for this message.message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.param1
- The first parameter for the message. See java.text.MessageFormat
.param2
- The second parameter for the message. See java.text.MessageFormat
.param3
- The third parameter for the message. See java.text.MessageFormat
.for further details.
public void log(int severity, java.lang.String message, java.lang.Object[] params)
severity
- The severity for this message.message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.params
- The parameter list for the message. See java.text.MessageFormat
.for further details.
public void log(java.lang.String message)
INFO_LEVEL
will be logged. The severity for this message is INFO_LEVEL
.
message
- The message that has to be logged.public void log(java.lang.String message, java.lang.Object param1)
INFO_LEVEL
will be logged. The severity for this message is INFO_LEVEL
.
message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.param1
- The first parameter for the message. See java.text.MessageFormat
.for further details.
public void log(java.lang.String message, java.lang.Object param1, java.lang.Object param2)
INFO_LEVEL
will be logged. The severity for this message is INFO_LEVEL
.
message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.param1
- The first parameter for the message. See java.text.MessageFormat
.param2
- The second parameter for the message. See java.text.MessageFormat
.for further details.
public void log(java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
INFO_LEVEL
will be logged. The severity for this message is INFO_LEVEL
.
message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.param1
- The first parameter for the message. See java.text.MessageFormat
.param2
- The second parameter for the message. See java.text.MessageFormat
.param3
- The third parameter for the message. See java.text.MessageFormat
.for further details.
public void log(java.lang.String message, java.lang.Object[] params)
INFO_LEVEL
will be logged. The severity for this message is INFO_LEVEL
.
message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.params
- The parameter list for the message. See java.text.MessageFormat
.for further details.
public void logException(int severity, java.lang.String message, java.lang.Object[] params, java.lang.Throwable t, boolean printStackTrace)
true
.
severity
- The severity for this message.message
- The message that has to be logged. See java.text.MessageFormat
for the format of this string.params
- The parameter list for the message. See java.text.MessageFormat
.t
- The Throwable that has to be logged.printStackTrace
- Indicates if the stack trace should be printed too.for further details.
public void logException(int severity, java.lang.String message, java.lang.Throwable t, boolean printStackTrace)
true
.
severity
- The severity for this message.message
- The message that has to be logged.t
- The Throwable that has to be logged.printStackTrace
- Indicates if the stack trace should be printed too.public void logException(java.lang.String message, java.lang.Throwable t, boolean printStackTrace)
true
. The message will be logged with severity ERROR_LEVEL
.
message
- The message that has to be logged.t
- The Throwable that has to be logged.printStackTrace
- Indicates if the stack trace should be printed too.public void logException(int severity, java.lang.Throwable t)
severity
- The severity for this message.t
- The Throwable that has to be logged.public void logException(int severity, java.lang.Throwable t, boolean printStackTrace)
true
.
severity
- The severity for this message.t
- The Throwable that has to be logged.printStackTrace
- Indicates if the stack trace should be printed too.public void logException(java.lang.Throwable t)
ERROR_LEVEL
.
t
- The Throwable that has to be logged.public void logException(java.lang.Throwable t, boolean printStackTrace)
ERROR_LEVEL
.
t
- The Throwable that has to be logged.printStackTrace
- Indicates if the stack trace should be printed too.public abstract boolean switchOn(boolean on)
true
iff the change was
successful.
on
- Description of the Parameter
public void reset()
public abstract boolean isLogging(int severity)
true
iff the given log severity will be logged.
severity
- The log severity that has to be checked.
true
iff the given log severity will be
logged.public void logFileContent(int severity, java.io.File file, java.lang.String encoding)
severity
- The severity for this message.file
- The file that has to be logged.encoding
- The encoding that should be used to read the filepublic java.io.Writer getWriter(int severity, java.lang.String message)
null
if trace is disabled.
severity
- The severity for this message.message
- A message that will be traced.
null
if trace is off otherwise current log writer is returned.public void releaseWriter(int severity, java.lang.String message)
severity
- The severity for this message.message
- A message that will be traced.public java.util.Vector read()
Enumeration
of
the log file lines. Returns an empty vector if the trace file is empty or
if there are any exceptions while reading the trace file. This method
alsoe reads the content of backup files if available.
Enumeration
of the log file lines. Returns
an empty vector if the trace file is empty or if there are any
exceptions while reading the trace file.public java.io.InputStream getLogContentAsStream()
null
if
there is no log content or if this feature is not supported by
corresponding log writer.
null
if there is
no content or if log writer does not provide this feature.public abstract int getEffectiveSeverity()
public abstract void setEffectiveSeverity(int severity)
severity
- the new log severitypublic abstract boolean isOn()
true
iff log is on.public abstract void refresh()
public java.lang.String getComponent()
"Unknown"
iff
componentname is not set.protected abstract LogWriter getLogWriter()
protected abstract void setLogWriter(LogWriter newLogWriter)
null
or it is not an instance of LogWriter
an
IllegalArgumentException will be thrown and the old log writes resists.
newLogWriter
- The new LogWriter instanceprotected abstract void readConfiguration(java.lang.String logName)
logName
- The name of the log.protected void writeConfiguration(java.lang.String logName, boolean userdependant)
logName
- The name of the log.userdependant
- Description of the Parameterprotected abstract void setOn(boolean on)
on
- The new on valueprotected abstract java.lang.String getLogWriterClassname()
protected void setComponent(java.lang.String componentname)
componentname
- protected java.lang.String getLogLevelName(int logLevel)
logLevel
- Description of the Parameter
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |