com.sapportals.portal.prt.logger

Interface ILogger


public interface ILogger

Interface for all logging objects. A logging object provides mechanism for logging errors and messages that are of interest to someone who is trying to monitor the system.

See Also:
Level

Method Summary
 Level getLevel()
          Gets the current verbosity level of this ILogger object.
 String getLocationName()
          Get the name of the location used by SAP logging and tracing.
 String getPattern()
          Gets the formatting pattern for output log messages.
 void info(Object originator, String message)
          Logs an INFO message.
 void info(Object originator, Throwable throwable, String message)
          Logs an INFO message.
 void info(String message)
          Logs an INFO message.
 void info(Throwable throwable, String message)
          Logs an INFO message.
 void initialize(Hashtable parameters, ILoggerContext loggerContext)
          The initialize method is called by the framework after the creation of the logger.
 boolean isActive()
          This method returns a boolean indicating whether or not this logger is currently active.
 void log(Object originator, String message, Level level)
          Prints log message.
 void log(Object originator, Throwable throwable, String message, Level level)
          Prints log message and stack trace.
 void log(String message, Level level)
          Prints a log message, with a given verbosity level.
 void log(Throwable throwable, String message, Level level)
          Prints log message and stack trace.
 void setActive(boolean isActive)
          Decides whether or not this logger is currently active.
 void setLevel(Level level)
          Set the verbosity level for this logger.
 void setLocationName(String locationName)
          The name of the location used by SAP logging and tracing.
 void setPattern(String pattern)
          Defines a custom formatting pattern.
 void severe(Object originator, String message)
          Logs a SEVERE message.
 void severe(Object originator, Throwable throwable, String message)
          Logs a SEVERE message.
 void severe(String message)
          Logs a SEVERE message.
 void severe(Throwable throwable, String message)
          Logs a SEVERE message.
 void warning(Object originator, String message)
          Logs a warning message.
 void warning(Object originator, Throwable throwable, String message)
          Logs a warning message.
 void warning(String message)
          Logs a warning message.
 void warning(Throwable throwable, String message)
          Logs a warning message.
 

Method Detail

getLevel

Level getLevel()
Gets the current verbosity level of this ILogger object.

Returns:
The Level value of this ILogger object.

setLevel

void setLevel(Level level)
Set the verbosity level for this logger. This controls how the logs will be filtered.

Parameters:
level - One of the verbosity level codes.

initialize

void initialize(Hashtable parameters,
                ILoggerContext loggerContext)
The initialize method is called by the framework after the creation of the logger. The parameters passed are extracted from the logger.xml file.

Parameters:
parameters - A set of optional parameters associated to a logger.
loggerContext - Holds global information of a logger, like its name.

isActive

boolean isActive()
This method returns a boolean indicating whether or not this logger is currently active.


setActive

void setActive(boolean isActive)
Decides whether or not this logger is currently active.

Parameters:
isActive -

getPattern

String getPattern()
Gets the formatting pattern for output log messages.


setPattern

void setPattern(String pattern)
Defines a custom formatting pattern. The pattern allows you to specify the message data fields, with place holders of the form "%[[-][-]]", interspersed with arbitrary text, that you want to have included in formatted messages. If you put a dash in front of the of the field to be printed, which is a positive integral number, the field is aligned on the right, in case of a trailing dash it is aligned on the left. If you flank with dashes on both sides, you get a centered field. If you omit the alignment, the field is left-aligned. The that specifies the field can be one of
  • i the message identification
  • p the time stamp in milliseconds since January 1, 1970 00:00:00 GMT
  • d the time stamp in readable form
  • c the log controller the message was issued through
  • l the location of origin
  • t the thread that emitted the message
  • g the group indentation
  • s the message severity
  • m the formatted message text To print a single %, insert a %%. With group indentation, width is interpreted as the indentation for each level with a standard value of 1, and alignment is ignored. As an example, the standard pattern "%24d %-40l [%t] %s: %m" lets the trace formatter print the date and time of the message in a 24-character column aligned to the left, followed by the right-aligned location truncated from the left to 40 characters, the thread name in brackets, and finally the severity name and the formatted message text separated with a colon. In order to be compliant with the SAP Logging API, this pattern respects the same format definition

    Parameters:
    pattern - Formatting pattern

  • setLocationName

    void setLocationName(String locationName)
    The name of the location used by SAP logging and tracing. You can find the all messages in SAP J2EE trace and / or in log. The trace is stored in defaultTra.trc and log is strored in server.log You can view all this messages using the J2EE Engine Administrator (/usr/sap//JC/j2ee/admin) or standalone log viewer (/usr/sap//JC/j2ee/admin/logviewer-standalone).


    getLocationName

    String getLocationName()
    Get the name of the location used by SAP logging and tracing.


    log

    void log(String message,
             Level level)
    Prints a log message, with a given verbosity level.

    Parameters:
    message - The message to log.
    level - What type of message is this? (WARNING/INFO/...)
    See Also:
    Level

    log

    void log(Throwable throwable,
             String message,
             Level level)
    Prints log message and stack trace.

    Parameters:
    throwable - The exception that was thrown.
    message - The message to log.
    level - Verbosity level required for that message.
    See Also:
    Level

    log

    void log(Object originator,
             String message,
             Level level)
    Prints log message.

    Parameters:
    originator - The object which send the message.
    message - The message to log.
    level - Verbosity level required for that message.
    See Also:
    Level

    log

    void log(Object originator,
             Throwable throwable,
             String message,
             Level level)
    Prints log message and stack trace.

    Parameters:
    originator - The object which send the message.
    throwable - The exception that was thrown.
    message - The message to log.
    level - Verbosity level required for that message.

    warning

    void warning(String message)
    Logs a warning message. If the logger is currently enabled for the WARNING message level, then the given message is printed.

    Parameters:
    message - The message to log.

    warning

    void warning(Throwable throwable,
                 String message)
    Logs a warning message. If the logger is currently enabled for the WARNING message level, then the given message is printed.

    Parameters:
    throwable - The exception that was thrown.
    message - The message to log.

    warning

    void warning(Object originator,
                 String message)
    Logs a warning message. If the logger is currently enabled for the WARNING message level, then the given message is printed.

    Parameters:
    originator - The object which send the message.
    message - The message to log.

    warning

    void warning(Object originator,
                 Throwable throwable,
                 String message)
    Logs a warning message. If the logger is currently enabled for the WARNING message level, then the given message is printed.

    Parameters:
    originator - The object which send the message.
    throwable - The exception that was thrown.
    message - The message to log.

    info

    void info(String message)
    Logs an INFO message. If the logger is currently enabled for the INFO message level, then the given message is printed.

    Parameters:
    message - The message to log.

    info

    void info(Throwable throwable,
              String message)
    Logs an INFO message. If the logger is currently enabled for the INFO message level, then the given message is printed.

    Parameters:
    throwable - The exception that was thrown.
    message - The message to log.

    info

    void info(Object originator,
              String message)
    Logs an INFO message. If the logger is currently enabled for the INFO message level, then the given message is printed.

    Parameters:
    originator - The object which send the message.
    message - The message to log.

    info

    void info(Object originator,
              Throwable throwable,
              String message)
    Logs an INFO message. If the logger is currently enabled for the INFO message level, then the given message is printed.

    Parameters:
    originator - The object which send the message.
    throwable - The exception that was thrown.
    message - The message to log.

    severe

    void severe(String message)
    Logs a SEVERE message. If the logger is currently enabled for the SEVERE message level, then the given message is printed.

    Parameters:
    message - The message to log.

    severe

    void severe(Throwable throwable,
                String message)
    Logs a SEVERE message. If the logger is currently enabled for the INFO message level, then the given message is printed.

    Parameters:
    throwable - The exception that was thrown.
    message - The message to log.

    severe

    void severe(Object originator,
                String message)
    Logs a SEVERE message. If the logger is currently enabled for the SEVERE message level, then the given message is printed.

    Parameters:
    originator - The object which send the message.
    message - The message to log.

    severe

    void severe(Object originator,
                Throwable throwable,
                String message)
    Logs a SEVERE message. If the logger is currently enabled for the SEVERE message level, then the given message is printed.

    Parameters:
    originator - The object which send the message.
    throwable - The exception that was thrown.
    message - The message to log.
    Access Rights

    This class can be accessed from:

    
    
    SC DC Public Part ACH
    [sap.com] EP-BASIS-API [sap.com] epbc.prtapi._apideprecated default EP-PIN-PRT
    [sap.com] EP-BASIS-API [sap.com] tc/epbc/prt/lib/api api EP-PIN
    [sap.com] EP-BASIS-API [sap.com] tc/epbc/prt/api api EP-PIN


    Copyright 2011 SAP AG Complete Copyright Notice