com.sap.ip.me.api.services
Class Log

java.lang.Object
  extended bycom.sap.ip.me.api.services.Log
All Implemented Interfaces:
LogSeverities

public class Log
extends java.lang.Object
implements LogSeverities

The logging class of the Mobile Engine framework. Every message that should be logged depending on the log level has to use this class.

Author:
SAP

Field Summary
 
Fields inherited from interface com.sap.ip.me.api.services.LogSeverities
ALL_LEVEL, DEBUG_LEVEL, DEVELOP_LEVEL, ERROR_LEVEL, EVENT_LEVEL, FATAL_LEVEL, INFO_LEVEL, PATH_LEVEL, STEP_LEVEL, WARNING_LEVEL
 
Constructor Summary
Log()
           
 
Method Summary
static int getCurrentTracelevel()
          Gets the current trace level.
static boolean isLogging(int severity)
          Returns true iff the given log severity will be logged.
static boolean isSwitchedOn()
          Returns true iff logging is enabled.
static void log(int severity, java.lang.String message)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(int severity, java.lang.String message, java.lang.Object param)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(int severity, java.lang.String message, java.lang.Object[] params)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(int severity, java.lang.String message, java.lang.Object param1, java.lang.Object param2)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(int severity, java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(java.lang.String message)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(java.lang.String message, java.lang.Object param1)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(java.lang.String message, java.lang.Object[] params)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(java.lang.String message, java.lang.Object param1, java.lang.Object param2)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void log(java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
          Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logException(int severity, java.lang.String message, java.lang.Object[] params, java.lang.Throwable t, boolean printStackTrace)
          Logs an Exception with a the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logException(int severity, java.lang.String message, java.lang.Throwable t, boolean printStackTrace)
          Logs an Exception with a the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logException(int severity, java.lang.Throwable t)
          Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logException(int severity, java.lang.Throwable t, boolean printStackTrace)
          Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logException(java.lang.String message, java.lang.Throwable t, boolean printStackTrace)
          Logs an Exception with a the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logException(java.lang.Throwable t)
          Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logException(java.lang.Throwable t, boolean printStackTrace)
          Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level.
static void logFileContent(int traceLevel, 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.
static java.util.Enumeration read()
          Reads the trace file and returns an String - Enumeration of the log file lines.
static void refresh()
          Do not use this method.This method is used be the framework only.
static void reset()
          Deletes the old log file.
static void setCurrentTracelevel(int newTracelevel)
          Sets the current trace level.
static void switchOff()
          Turns of the log.
static void switchOn()
          Switches the log on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log

public Log()
Method Detail

logFileContent

public static final void logFileContent(int traceLevel,
                                        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.

Parameters:
traceLevel - The severity for this message.
file - The file that has to be logged.

setCurrentTracelevel

public static void setCurrentTracelevel(int newTracelevel)
Sets the current trace level.

Parameters:
newTracelevel - The new current trace level.

getCurrentTracelevel

public static int getCurrentTracelevel()
Gets the current trace level.

Returns:
The current trace level.

isLogging

public static boolean isLogging(int severity)
Returns true iff the given log severity will be logged.

Parameters:
severity - The log severity that has to be checked.
Returns:
true iff the given log severity will be logged.

isSwitchedOn

public static boolean isSwitchedOn()
Returns true iff logging is enabled.

Returns:
true iff logging is enabled.

switchOn

public static void switchOn()
Switches the log on.


switchOff

public static void switchOff()
Turns of the log.


reset

public static void reset()
Deletes the old log file. If log was switched on it will be switched on after deletion of the trace file.


log

public static void log(int severity,
                       java.lang.String message)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.

Parameters:
severity - The severity for this message.
message - The message that has to be logged.

log

public static void log(int severity,
                       java.lang.String message,
                       java.lang.Object param)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.

Parameters:
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 .
See Also:
Description of the Method

log

public static void log(int severity,
                       java.lang.String message,
                       java.lang.Object param1,
                       java.lang.Object param2)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.

Parameters:
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 list for the message. See java.text.MessageFormat .
See Also:
Description of the Method

log

public static void log(int severity,
                       java.lang.String message,
                       java.lang.Object param1,
                       java.lang.Object param2,
                       java.lang.Object param3)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.

Parameters:
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 .
See Also:
Description of the Method

log

public static void log(int severity,
                       java.lang.String message,
                       java.lang.Object[] params)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level.

Parameters:
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 .
See Also:
Description of the Method

log

public static void log(java.lang.String message)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level. The message will be logged with severity INFO_LEVEL.

Parameters:
message - The message that has to be logged.

log

public static void log(java.lang.String message,
                       java.lang.Object param1)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level. The message will be logged with severity INFO_LEVEL.

Parameters:
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 .
See Also:
Description of the Method

log

public static void log(java.lang.String message,
                       java.lang.Object param1,
                       java.lang.Object param2)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level. The message will be logged with severity INFO_LEVEL.

Parameters:
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 .
See Also:
Description of the Method

log

public static void log(java.lang.String message,
                       java.lang.Object param1,
                       java.lang.Object param2,
                       java.lang.Object param3)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level. The message will be logged with severity INFO_LEVEL.

Parameters:
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 .
See Also:
Description of the Method

log

public static void log(java.lang.String message,
                       java.lang.Object[] params)
Logs the message into the log file if log is switched on and the severity is less or equal the current trace level. The message will be logged with severity INFO_LEVEL.

Parameters:
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 .
See Also:
Description of the Method

logException

public static void logException(int severity,
                                java.lang.String message,
                                java.lang.Object[] params,
                                java.lang.Throwable t,
                                boolean printStackTrace)
Logs an Exception with a the message into the log file if log is switched on and the severity is less or equal the current trace level. The stacktrace of the exception is logged if the given flag is true
Parameters:
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 - Description of the Parameter
See Also:
Description of the Method

logException

public static void logException(int severity,
                                java.lang.String message,
                                java.lang.Throwable t,
                                boolean printStackTrace)
Logs an Exception with a the message into the log file if log is switched on and the severity is less or equal the current trace level. The stacktrace of the exception is logged if the given flag is true
Parameters:
severity - The severity for this message.
message - The message that has to be logged.
t - The Throwable that has to be logged.
printStackTrace - Description of the Parameter

logException

public static void logException(java.lang.String message,
                                java.lang.Throwable t,
                                boolean printStackTrace)
Logs an Exception with a the message into the log file if log is switched on and the severity is less or equal the current trace level. The stacktrace of the exception is logged if the given flag is trueERROR_LEVEL.

Parameters:
message - The message that has to be logged.
t - The Throwable that has to be logged.
printStackTrace - Description of the Parameter

logException

public static void logException(int severity,
                                java.lang.Throwable t)
Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level. The stacktrace of the exception is logged.

Parameters:
severity - The severity for this message.
t - The Throwable that has to be logged.

logException

public static void logException(int severity,
                                java.lang.Throwable t,
                                boolean printStackTrace)
Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level. The stacktrace of the exception is logged if the given flag is true
Parameters:
severity - The severity for this message.
t - The Throwable that has to be logged.
printStackTrace - Description of the Parameter

logException

public static void logException(java.lang.Throwable t)
Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level. The stacktrace of the exception is logged. The message will be logged with severity ERROR_LEVEL.

Parameters:
t - The Throwable that has to be logged.

logException

public static void logException(java.lang.Throwable t,
                                boolean printStackTrace)
Logs an Exception without a the message into the log file if log is switched on and the severity is less or equal the current trace level. The stacktrace of the exception is logged if the given flag is trueERROR_LEVEL.

Parameters:
t - The Throwable that has to be logged.
printStackTrace - Description of the Parameter

read

public static java.util.Enumeration read()
Reads the trace file and returns an String - Enumeration of the log file lines. Returns null if the trace file is empty or if there are any exceptions while reading the trace file.

Returns:
String - Enumeration of the log file lines. Returns empty enumeration if the trace file is empty or if there are any exceptions while reading the trace file.

refresh

public static void refresh()
Do not use this method.This method is used be the framework only. This method should be called if the trace level has been changed via Mobile Engine configuration or at startup.



Copyright © 2005 SAP AG. All Rights Reserved.