|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Interface for Mobile Infrastructure log writers. If you want to use your own
log writer you have to implement this interface. After that you can
configure the Mobile Infrastructure to use your log writer implementation
instead of the default log writers of the Mobile Infrastructure. The default
log writers for AppLog and Trace are instances of
DefaultFileLogWriter. You can change it for example by editing
the MobileEngine.config file in settings folder of
the Mobile Infrastructure installation.
The default settings are:
MobileEngine.Trace.Implementation = com.sap.ip.me.api.logging.DefaultFileLogWriter
MobileEngine.AppLog.Implementation = com.sap.ip.me.api.logging.DefaultFileLogWriter
Example:
Set DefaultSystemLogWriter for AppLog and com.mycompany.mi.MyLogWriter
for Trace:
Open the settings\MobileEngine.config file from your MI
installation. If there are already lines for the following keys edit the
lines or append the following two lines to the config file:
MobileEngine.Trace.Implementation = com.mycompany.mi.MyLogWriter
MobileEngine.AppLog.Implementation = com.sap.ip.me.api.logging.DefaultSystemLogWriter
Take care that the jar file that contains the custom log writer is in the
class path (contained in listOfJars.txt). Restart the Mobile
Infrastructure.
| Method Summary | |
java.util.Vector |
getLogContent()
Returns a line vector of the log content. |
void |
initialize(java.lang.String configurationPrefix)
Initializes the log writer with given configuration prefix. |
void |
logFileContent(int severity,
java.lang.String component,
java.io.File file,
java.lang.String encoding)
Logs the content of a file into the log. |
boolean |
reset()
Resets the log (delete the log file, empty the internal representation of the log). |
void |
setPrintAppendix(boolean printAppendix)
Sets the flag if the log appendix should be written everytime the log is switched off. |
void |
setPrintProlog(boolean printProlog)
Sets the flag if the log prolog should be written everytime the log is switched on. |
boolean |
switchOn(boolean on)
Switch the log writer on or off. |
void |
writeln(int severity,
java.lang.String component,
java.lang.String message,
java.lang.Object[] params)
Formats the message and writes it into the log. |
void |
writeln(int severity,
java.lang.String component,
java.lang.String message,
java.lang.Object[] params,
java.lang.Throwable t,
boolean printStacktrace)
Formats the message and writes it into the log. |
| Method Detail |
public void writeln(int severity,
java.lang.String component,
java.lang.String message,
java.lang.Object[] params)
severity - The severity for this message.component - The component that logs 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
.MessageFormat
public void writeln(int severity,
java.lang.String component,
java.lang.String message,
java.lang.Object[] params,
java.lang.Throwable t,
boolean printStacktrace)
printStacktrace
parameter a stack trace of the Exception will be logged too.
severity - The severity for this message.component - The component that logs 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 - true iff the stacktrace should be
logged.MessageFormatpublic boolean switchOn(boolean on)
on - true iff the log should be switched on. The log
writer has to handle multiple calls of this method.
true if switch was successful.public boolean reset()
true iff reset was successful
public void logFileContent(int severity,
java.lang.String component,
java.io.File file,
java.lang.String encoding)
severity - The log severity for this file.component - The component that logs this file.file - The file that has to be logged.encoding - The encoding that should be used to read the filepublic java.util.Vector getLogContent()
null
, returns empty vector instead.
public void initialize(java.lang.String configurationPrefix)
AppLog or Trace
instances.
configurationPrefix - The configuration prefix that should be used to
initialize the log writer (e.g. MobileEngine.Trace)public void setPrintProlog(boolean printProlog)
printProlog - true if the log prolog should be written.public void setPrintAppendix(boolean printAppendix)
printAppendix - true if the log appendix should be
written.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||