com.sapportals.common

Class PPLogger

java.lang.Object
  extended by com.sapportals.common.PPLogger

public class PPLogger
extends Object

The class that provides methods for writing log and trace entries (messages).

Log messages are meant for system administrators to monitor the portal behavior.

Trace messages are meant for developers and support engineers, who need to be able to understand the program flow and analyze the context.

Each message includes information about the importance (or severity) of the event and the application or category from which the message is written.


Constructor Summary
PPLogger(com.sap.tc.logging.Category category, com.sap.tc.logging.Location location)
          Constructs a PPLogger instance.
PPLogger(String subCategoryName, String locationName)
          Constructs a PPLogger instance.
 
Method Summary
 boolean beLogged(LoggingConsts severity)
          Indicates whether the logger is configured to write log entries for a specific severity.
 boolean beTraced(TracingConsts severity)
          Indicates whether the logger is configured to write trace entries for a specific severity.
protected  void internalLog(int severity, String messageFormat, String[] paramsArray)
          Writes a log message with a specific severity and parameters.
protected  void internalTrace(int severity, String subLoc, String messageFormat, String[] paramsArray)
          Writes a trace message with a specific severity and sub-location.
 void log(LoggingConsts severity, String message)
          Writes a log message with a specific severity.
 void log(LoggingConsts severity, String messageFormat, String param1)
          Writes a log message with a specific severity.
 void log(LoggingConsts severity, String messageFormat, String param1, String param2)
          Writes a log message with a specific severity.
 void log(LoggingConsts severity, String messageFormat, String param1, String param2, String param3)
          Writes a log message with a specific severity.
 void log(LoggingConsts severity, String messageFormat, String param1, String param2, String param3, String param4)
          Writes a log message with a specific severity.
 void trace(TracingConsts severity, String subLoc, String message)
          Writes a trace message with a specific severity and sub-location.
 void trace(TracingConsts severity, String subLoc, String messageFormat, String param1)
          Writes a trace message with a specific severity and sub-location.
 void trace(TracingConsts severity, String subLoc, String messageFormat, String param1, String param2)
          Writes a trace message with a specific severity and sub-location.
 void trace(TracingConsts severity, String subLoc, String messageFormat, String param1, String param2, String param3)
          Writes a trace message with a specific severity and sub-location.
 void trace(TracingConsts severity, String subLoc, String messageFormat, String param1, String param2, String param3, String param4)
          Writes a trace message with a specific severity and sub-location.
 void traceThrowableT(TracingConsts severity, String subLoc, Throwable e)
          Writes a trace entry with a specific severity and sub-location.
 void traceThrowableT(TracingConsts severity, String subLoc, Throwable e, String message)
          Writes a trace message with a specific severity and sub-location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PPLogger

public PPLogger(com.sap.tc.logging.Category category,
                com.sap.tc.logging.Location location)
Constructs a PPLogger instance.

Parameters:
category - a category of the logging entries
location - a location of the tracing entries

PPLogger

public PPLogger(String subCategoryName,
                String locationName)
Constructs a PPLogger instance.

Parameters:
subCategoryName - the name of the category related to logging entries
locationName - the name of the location of the tracing entries
Method Detail

log

public void log(LoggingConsts severity,
                String message)
Writes a log message with a specific severity.

Parameters:
severity - the severity level of the log entry
message - the message to be written

log

public void log(LoggingConsts severity,
                String messageFormat,
                String param1)
Writes a log message with a specific severity.

Parameters:
severity - the severity level of the log entry
messageFormat - the message to be written with a placeholder for one parameter
param1 - the messageFormat parameter

log

public void log(LoggingConsts severity,
                String messageFormat,
                String param1,
                String param2)
Writes a log message with a specific severity.

Parameters:
severity - the severity level of the log entry
messageFormat - the message to be written with placeholders for two parameters
param1 - the first messageFormat parameter
param2 - the second messageFormat parameter

log

public void log(LoggingConsts severity,
                String messageFormat,
                String param1,
                String param2,
                String param3)
Writes a log message with a specific severity.

Parameters:
severity - the severity level of the log entry
messageFormat - the message to be written with placeholders for three parameters
param1 - the first messageFormat parameter
param2 - the second messageFormat parameter
param3 - the third messageFormat parameter

log

public void log(LoggingConsts severity,
                String messageFormat,
                String param1,
                String param2,
                String param3,
                String param4)
Writes a log message with a specific severity.

Parameters:
severity - the severity level of the log entry
messageFormat - the message to be written with placeholders for four parameters
param1 - the first messageFormat parameter
param2 - the second messageFormat parameter
param3 - the third messageFormat parameter
param4 - the fourth messageFormat parameter

trace

public void trace(TracingConsts severity,
                  String subLoc,
                  String message)
Writes a trace message with a specific severity and sub-location.

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example, "this.getClass().getName()"
message - the message to be written

trace

public void trace(TracingConsts severity,
                  String subLoc,
                  String messageFormat,
                  String param1)
Writes a trace message with a specific severity and sub-location.

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example, "this.getClass().getName()"
messageFormat - the message to be written with a placeholder for one parameter
param1 - the messageFormat parameter

trace

public void trace(TracingConsts severity,
                  String subLoc,
                  String messageFormat,
                  String param1,
                  String param2)
Writes a trace message with a specific severity and sub-location.

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example, "this.getClass().getName()"
messageFormat - the message to be written with placeholders for two parameters
param1 - the first messageFormat parameter
param2 - the second messageFormat parameter

trace

public void trace(TracingConsts severity,
                  String subLoc,
                  String messageFormat,
                  String param1,
                  String param2,
                  String param3)
Writes a trace message with a specific severity and sub-location.

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example, "this.getClass().getName()"
messageFormat - the message to be written with placeholders for three parameters
param1 - the first messageFormat parameter
param2 - the second messageFormat parameter
param3 - the third messageFormat parameter

trace

public void trace(TracingConsts severity,
                  String subLoc,
                  String messageFormat,
                  String param1,
                  String param2,
                  String param3,
                  String param4)
Writes a trace message with a specific severity and sub-location.

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example, "this.getClass().getName()"
messageFormat - the message to be written with placeholders for four parameters
param1 - the first messageFormat parameter
param2 - the second messageFormat parameter
param3 - the third messageFormat parameter
param4 - the forth messageFormat parameter

traceThrowableT

public void traceThrowableT(TracingConsts severity,
                            String subLoc,
                            Throwable e)
Writes a trace entry with a specific severity and sub-location.

This method should be invoked from a catch section of code

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example, "this.getClass().getName()"
e - the exception catched by the code

traceThrowableT

public void traceThrowableT(TracingConsts severity,
                            String subLoc,
                            Throwable e,
                            String message)
Writes a trace message with a specific severity and sub-location.

This method should be invoked from a catch section of code.

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example, "this.getClass().getName()"
e - the exception catched by the code
message - the message to be written

beLogged

public boolean beLogged(LoggingConsts severity)
Indicates whether the logger is configured to write log entries for a specific severity.

Parameters:
severity - Returns true if the logger is configured to write log entries for the specified severity

beTraced

public boolean beTraced(TracingConsts severity)
Indicates whether the logger is configured to write trace entries for a specific severity.

Parameters:
severity - Returns true if the logger is configured to write trace entries for the specified severity

internalLog

protected void internalLog(int severity,
                           String messageFormat,
                           String[] paramsArray)
Writes a log message with a specific severity and parameters.

The following method does not apply any restrictions regarding the message format and parameters.

Parameters:
severity - the severity level of the log entry
messageFormat - the message to be written with placeholders for parameters
paramsArray - an array of all the message parameters

internalTrace

protected void internalTrace(int severity,
                             String subLoc,
                             String messageFormat,
                             String[] paramsArray)
Writes a trace message with a specific severity and sub-location.

The following method does not apply any restrictions regarding the message format and parameters.

Parameters:
severity - the severity level of the trace entry
subLoc - the sub-location of the trace, for example "this.getClass().getName()"
messageFormat - the message to be written with placeholders for parameters
paramsArray - an array of all the message parameters
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] EP-RUNTIME [sap.com] tc/ep/common/api api EP-PIN


Copyright 2012 SAP AG Complete Copyright Notice