com.sap.tc.logging

Class SimpleLogger

java.lang.Object
  extended by com.sap.tc.logging.SimpleLogger

public class SimpleLogger
extends Object

Exposes main functionality of SAP Logging API by the means of several, easy to use methods


Constructor Summary
SimpleLogger()
           
 
Method Summary
static boolean isWritable(int severity, LogController lc)
          Determines if a message with provided severity will pass severity check for Log Controller and will be written
static LogRecord log(int severity, Category category, Location location, String messageID, String message)
          Issues a log message through a Category.
static LogRecord log(int severity, Category category, Location location, String messageID, String message, Object... args)
          Issues a log message through a Category.
static LogRecord log(int severity, Category category, Location location, String dcName, String csnComponent, String messageID, String message, Object... args)
          Issues a log message through a Category.
static LogRecord trace(int severity, Location location, String message)
          Issues a trace message through a Location
static LogRecord trace(int severity, Location location, String message, Object... args)
          Issues a trace message through a Location.
static LogRecord trace(int severity, Location location, String messageID, String message)
          Issues a trace message through a Location.
static LogRecord trace(int severity, Location location, String messageID, String message, Object... args)
          Issues a trace message through a Location.
static LogRecord trace(int severity, Location location, String dcName, String csnComponent, String messageID, String message, Throwable exc, Object... args)
          Issues a trace message through a Location.
static LogRecord traceThrowable(int severity, Location location, String messageID, String message, Throwable exc)
          Issues a trace message through a Location.
static LogRecord traceThrowable(int severity, Location location, String message, Throwable exc)
          Issues a trace message through a Location. traceThrowable methods are designed to format and write exception stacktraces.
static LogRecord traceThrowable(int severity, Location location, Throwable exc, String messageID, String message, Object... args)
          Issues a trace message through a Location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLogger

public SimpleLogger()
Method Detail

isWritable

public static boolean isWritable(int severity,
                                 LogController lc)
Determines if a message with provided severity will pass severity check for Log Controller and will be written

Parameters:
severity - Severity to check against
lc - Log Controller to chack against
Returns:
true if a message with specified severity will be written through specified Log Controller. False otherwise.

trace

public static LogRecord trace(int severity,
                              Location location,
                              String message)
Issues a trace message through a Location

Parameters:
severity - severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
message - the message text itself
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

trace

public static LogRecord trace(int severity,
                              Location location,
                              String messageID,
                              String message)
Issues a trace message through a Location. Makes use of Message ID concept.

Parameters:
severity - severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
messageID - messageID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - the message text itself
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

trace

public static LogRecord trace(int severity,
                              Location location,
                              String message,
                              Object... args)
Issues a trace message through a Location.

Parameters:
severity - severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
message - the message text itself
args - values to be placed in the text message. Each of the message placeholders {0}, {1} will be replaced with args[0], args[1], etc.
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

trace

public static LogRecord trace(int severity,
                              Location location,
                              String messageID,
                              String message,
                              Object... args)
Issues a trace message through a Location.

Parameters:
severity - severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
messageID - messageID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - the message text itself
args - values to be placed in the text message. Each of the message placeholders {0}, {1} will be replaced with args[0], args[1], etc.
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

trace

public static LogRecord trace(int severity,
                              Location location,
                              String dcName,
                              String csnComponent,
                              String messageID,
                              String message,
                              Throwable exc,
                              Object... args)
Issues a trace message through a Location.

Parameters:
severity - severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
dcName - DC name to be written in the trace entry
csnComponent - CSN Component to be written in the trace entry
messageID - messageID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - the message text itself
exc - If not null, the exception stacktrace is formatted and appended at the end of the trace record as a message parameter
args - values to be placed in the text message. Each of the message placeholders {0}, {1} will be replaced with args[0], args[1], etc.
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

traceThrowable

public static LogRecord traceThrowable(int severity,
                                       Location location,
                                       String message,
                                       Throwable exc)
Issues a trace message through a Location. traceThrowable methods are designed to format and write exception stacktraces.

Parameters:
severity - Severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
message - The message text itself. It should be different from exc.getMessage()
exc - The exception stacktrace is formatted and appended at the end of the trace record as a message parameter
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

traceThrowable

public static LogRecord traceThrowable(int severity,
                                       Location location,
                                       String messageID,
                                       String message,
                                       Throwable exc)
Issues a trace message through a Location. Makes use of Message ID concept. traceThrowable methods are designed to format and write exception stacktraces.

Parameters:
severity - Severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
messageID - messageID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - The message text itself. It should be different from exc.getMessage()
exc - The exception stacktrace is formatted and appended at the end of the trace record as a message parameter
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

traceThrowable

public static LogRecord traceThrowable(int severity,
                                       Location location,
                                       Throwable exc,
                                       String messageID,
                                       String message,
                                       Object... args)
Issues a trace message through a Location. Makes use of Message ID concept. traceThrowable methods are designed to format and write exception stacktraces.

Parameters:
severity - Severity of the trace message that is issued
location - Location where the message will be dispatched to and from where (if severity check is passed) it will be issued.
exc - The exception stacktrace is formatted and appended at the end of the trace record as a message parameter
messageID - messageID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - The message text itself. It should be different from exc.getMessage()
args - values to be placed in the text message. Each of the message placeholders {0}, {1} will be replaced with args[0], args[1], etc.
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

log

public static LogRecord log(int severity,
                            Category category,
                            Location location,
                            String messageID,
                            String message,
                            Object... args)
Issues a log message through a Category. It is also dispatched to traces through the Location provided. Makes use of Message ID concept which should be adopted by each log message.

Parameters:
severity - severity of the trace message that is issued
Category - Category where the message will be dispatched to and from where (if severity check is passed) it will be issued.
location - If a message has been produced by Category, it will also be dispatched to the Location so that it will go to traces as well.
messageID - messageID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - the message text itself
args - values to be placed at the end of the log entry as parameters. Each of the message placeholders {0}, {1} will correspond to args[0], args[1], etc. These placeholders will not be replaced in the plain text entry but will be replaced if logs are viewed with Log Viewer.
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

log

public static LogRecord log(int severity,
                            Category category,
                            Location location,
                            String dcName,
                            String csnComponent,
                            String messageID,
                            String message,
                            Object... args)
Issues a log message through a Category. It is also dispatched to traces through the Location provided. Makes use of Message ID concept which should be adopted by each log message.

Parameters:
severity - Severity of the trace message that is issued
Category - Category where the message will be dispatched to and from where (if severity check is passed) it will be issued.
location - If a message has been produced by Category, it will also be dispatched to the Location so that it will go to traces as well.
dcName - DC name to be written in the log entry. If dcName and csnComponent are null they are evaluated during runtime.
csnComponent - CSN Component to be written in the log entry. If dcName and csnComponent are null they are evaluated during runtime.
messageID - Message ID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - The message text itself
args - Values to be placed at the end of the log entry as parameters. Each of the message placeholders {0}, {1} will correspond to args[0], args[1], etc. These placeholders will not be replaced in the plain text entry but will be replaced if logs are viewed with Log Viewer.
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.

log

public static LogRecord log(int severity,
                            Category category,
                            Location location,
                            String messageID,
                            String message)
Issues a log message through a Category. It is also dispatched to traces through the Location provided. Makes use of Message ID concept which should be adopted by each log message.

Parameters:
severity - severity of the trace message that is issued
Category - Category where the message will be dispatched to and from where (if severity check is passed) it will be issued.
location - If a message has been produced by Category, it will also be dispatched to the Location so that it will go to traces as well.
messageID - messageID to be assigned to this message. MessageID format is [prefix]-[range][number] (e.g. ASJ-jndi-000135)
message - the message text itself
Returns:
LogRecord object encapsulating the message that has been written. null if no message has been written.
Access Rights

This class can be accessed from:


SC DC
[sap.com] FRAMEWORK [sap.com] tc/ddic/ddicruntime
[sap.com] ENGINEAPI [sap.com] tc/logging
[sap.com] ENGFACADE [sap.com] tc/bl/logging/api
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.lib
[sap.com] BRMS-FACADE [sap.com] tc/brms/facade


Copyright 2010 SAP AG Complete Copyright Notice