com.sap.tc.mobile.logging
Class LogController

java.lang.Object
  extended by com.sap.tc.mobile.logging.LogController
Direct Known Subclasses:
Category, Location

public abstract class LogController
extends java.lang.Object

Log controller. This resembles standard SAP Logging API, with some limitations.

Author:
d039184

Nested Class Summary
static interface LogController.LogImplementation
          MI private log implementation interface.
 
Field Summary
static boolean isPDA
           
protected static LogController.LogImplementation mobileImpl
          Logger implementation for all non-Web-Dynpro logging needs.
protected static MsgObject NULL_OBJECT
          Message object to use in case null was passed for message object.
protected static LogController.LogImplementation standardImpl
          Logger implementation mainly for Web Dynpro logging.
 
Constructor Summary
protected LogController(java.lang.String name, LogController parent)
          Create new log controller.
 
Method Summary
 boolean beDebug()
          Same as beLogged(int)but always checks for a debug message, that is a message with severity Severity.DEBUG.
 boolean beError()
          Same as beLogged(int)but always checks for an error message, that is a message with severity Severity.ERROR.
 boolean beFatal()
          Same as beLogged(int)but always checks for a fatal error message, that is a message with severity Severity.FATAL.
 boolean beInfo()
          Same as beLogged(int)but always checks for an informational message, that is a message with severity Severity.INFO.
 boolean beLogged(int severity)
          Checks whether a message with the specified severity would be written via this log controller.
 boolean bePath()
          Same as beLogged(int)but always checks for a path message, that is a message with severity Severity.PATH.
 boolean beWarning()
          Same as beLogged(int)but always checks for a warning message, that is a message with severity Severity.WARNING.
protected  void enableTrace(boolean enable)
           
protected  void exceptionImpl(boolean trace, int severity, Location loc, java.lang.String subLoc, java.lang.Object msgCode, java.lang.Object[] args, java.lang.String msgClear, java.lang.Throwable exc)
           
 java.util.Collection getChildren()
          Gets the collection of children of this log controller.
 int getEffectiveSeverity()
          Gets the current effective severity of this log controller.
 int getMaximumSeverity()
          Gets the current maximum severity of this log controller.
 int getMinimumSeverity()
          Gets the current minimum severity of this log controller.
 java.lang.String getName()
          Get name of this log controller.
protected  LogController getParentInt()
          Get parent log controller.
static void init()
           
protected  boolean isTraceEnabled()
           
protected  void logImpl(int severity, Category category, java.lang.String subLoc, java.lang.Object messageCode, java.lang.Object[] args, java.lang.String clearMsg)
           
protected  void logImpl(int severity, Location location, java.lang.String subLoc, java.lang.Object messageCode, java.lang.Object[] args, java.lang.String clearMsg)
           
protected  void reset()
          Reset this LogController to the initial state.
protected  void resetAll()
          Reset this LogController and his children to the initial state
protected  void setEffectiveSeverity()
          Resets the effective severity of this log controller.
protected  void setEffectiveSeverity(int severity)
          Sets the effective severity of this log controller.
protected  void setMaximumSeverity()
          Resets the maximum severity of this log controller.
protected  void setMaximumSeverity(int severity)
          Sets the maximum severity of this log controller.
protected  void setMinimumSeverity()
          Resets the minimum severity of this log controller.
protected  void setMinimumSeverity(int severity)
          Sets the minimum severity of this log controller.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isPDA

public static boolean isPDA

NULL_OBJECT

protected static final MsgObject NULL_OBJECT
Message object to use in case null was passed for message object.


standardImpl

protected static final LogController.LogImplementation standardImpl
Logger implementation mainly for Web Dynpro logging.


mobileImpl

protected static final LogController.LogImplementation mobileImpl
Logger implementation for all non-Web-Dynpro logging needs.

Constructor Detail

LogController

protected LogController(java.lang.String name,
                        LogController parent)
Create new log controller.

Parameters:
name - controller name.
parent - controller parent.
Method Detail

init

public static void init()

logImpl

protected void logImpl(int severity,
                       Category category,
                       java.lang.String subLoc,
                       java.lang.Object messageCode,
                       java.lang.Object[] args,
                       java.lang.String clearMsg)

logImpl

protected void logImpl(int severity,
                       Location location,
                       java.lang.String subLoc,
                       java.lang.Object messageCode,
                       java.lang.Object[] args,
                       java.lang.String clearMsg)

isTraceEnabled

protected boolean isTraceEnabled()

enableTrace

protected void enableTrace(boolean enable)

exceptionImpl

protected void exceptionImpl(boolean trace,
                             int severity,
                             Location loc,
                             java.lang.String subLoc,
                             java.lang.Object msgCode,
                             java.lang.Object[] args,
                             java.lang.String msgClear,
                             java.lang.Throwable exc)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getParentInt

protected LogController getParentInt()
Get parent log controller.

Returns:
parent log controller.

getName

public java.lang.String getName()
Get name of this log controller.

Returns:
name of this log controller.

beLogged

public boolean beLogged(int severity)
Checks whether a message with the specified severity would be written via this log controller. The purpose of this method is to avoid evaluating the arguments of a logging call, which is expensive and would be superfluous if a message is not written because of its insufficient severity. The result returned is necessary but not sufficient for writing log messages, that is if the method returns false the message is not going to be written but not vice versa. To this end, the method checks whether the specified severity is equal to or higher than the effective severity of the controller. It does neither take into account severities assigned to relations with other log controllers nor filters associated with the log controller or logs. This version of the method is more efficient than the version also taking another log controller as argument, and therefore better fits the purpose to avoid inefficiencies.

Parameters:
severity - Severity of message to be written

beDebug

public boolean beDebug()
Same as beLogged(int)but always checks for a debug message, that is a message with severity Severity.DEBUG.


bePath

public boolean bePath()
Same as beLogged(int)but always checks for a path message, that is a message with severity Severity.PATH.


beInfo

public boolean beInfo()
Same as beLogged(int)but always checks for an informational message, that is a message with severity Severity.INFO.


beWarning

public boolean beWarning()
Same as beLogged(int)but always checks for a warning message, that is a message with severity Severity.WARNING.


beError

public boolean beError()
Same as beLogged(int)but always checks for an error message, that is a message with severity Severity.ERROR.


beFatal

public boolean beFatal()
Same as beLogged(int)but always checks for a fatal error message, that is a message with severity Severity.FATAL.


setMinimumSeverity

protected void setMinimumSeverity(int severity)
Sets the minimum severity of this log controller. If its current maximum severity is lower than the argument, the former is set to the argument. If it is a mobileLocationRoot controller, this method has the same effect as a call to setEffectiveSeverity(int).

Parameters:
severity - New minimum severity

setMinimumSeverity

protected void setMinimumSeverity()
Resets the minimum severity of this log controller. If it is a mobileLocationRoot controller this method has no effect, otherwise it has the same effect as a call to setMinimumSeverity(int) with Severity.ALL.


setEffectiveSeverity

protected void setEffectiveSeverity(int severity)
Sets the effective severity of this log controller. If it is a mobileLocationRoot controller, this method sets the effective severity to its argument, otherwise it has the same effect as calls with its argument to both setMinimumSeverity(int) and setMaximumSeverity(int).

Parameters:
severity - New effective severity

setEffectiveSeverity

protected void setEffectiveSeverity()
Resets the effective severity of this log controller. If it is a mobileLocationRoot controller this method has no effect, otherwise it has the same effect as two calls to setMinimumSeverity() and setMaximumSeverity().


setMaximumSeverity

protected void setMaximumSeverity(int severity)
Sets the maximum severity of this log controller. If its current minimum severity is higher than the argument, the former is set to the argument. If it is a mobileLocationRoot controller, the method has the same effect as a call to setEffectiveSeverity(int).

Parameters:
severity - New maximum severity

setMaximumSeverity

protected void setMaximumSeverity()
Resets the maximum severity of this log controller. If it is a mobileLocationRoot controller this method has no effect, otherwise it has the same effect as a call to setMinimumSeverity(int) with Severity.NONE.


getMinimumSeverity

public int getMinimumSeverity()
Gets the current minimum severity of this log controller.

Returns:
Minimum severity if set or Severity.ALL.

getEffectiveSeverity

public int getEffectiveSeverity()
Gets the current effective severity of this log controller.

Returns:
Effective severity if set or Severity.NONE.

getMaximumSeverity

public int getMaximumSeverity()
Gets the current maximum severity of this log controller.

Returns:
Maximum severity if set or Severity.NONE.

reset

protected void reset()
Reset this LogController to the initial state.


resetAll

protected void resetAll()
Reset this LogController and his children to the initial state


getChildren

public java.util.Collection getChildren()
Gets the collection of children of this log controller.

Returns:
Unmodifiable collection of children