Entering content frame

Procedure documentation Defining a Logger Configuration Locate the document in its SAP Library structure

Use

Each logger accessed by the portal logging API is defined by the following files:

·        Logger.xml in the WEB-INF\portal\system\xml directory

Contains internal PRT loggers such as the default logger

·        Logger.xml in the PORTAL-INF/logger folder of the PAR file

Procedure

A portal application can define its own logger by packaging a logger configuration file in its PAR file:

<Portal Archive>

  |

  +-- META-INF

  +-- MANIFEST.MF

  +-- …

  +-- PORTAL-INF

  |   |

  |   +-- portalapp.xml

  |   |   +-- logger

  |   |       +-- logger.xml

The logger configuration file gives a list of PRT loggers. Each logger in this list is a model proposing two different views:

·        Application Developer view.

A logger is defined by its name, a Java interface, a String formatting pattern, the default activation flag and a logging level. Once a logger has been defined it can be accessed using the Portal Runtime API by using:

¡        getLogger(String) on the portal component request

¡        getLogger(String) on the service context

·        Administrator view

A logger is associated to one or more logging classes defining the output channels.

This separation enables the developer to be isolated from the logging infrastructure and enables the administrator to manage the locations of the log files without disturbing the application behavior.

Example

logger.xmlfile used to define the default logger of the PRT:

<Logger

      name                 = "default_logger"

      loggerInterface      = "com.sapportals.portal.prt.logger.ILogger"

      isActive             = "true"

      pattern              = "%d # %20t %15s %m #">

          <LoggerClass

                 className      = "com.sapportals.portal.prt.logger.SimpleFileLogger"

                 level          = "WARNING">

                 <param

                     filename   = "logs/workplace.log"

                     append     = "false"

                     limit      = "800000">

                 </param>

           </LoggerClass>

           <LoggerClass

                 className      = "com.sapportals.portal.prt.logger.ConsoleLogger"

                 level          = "SEVERE"

                 >

           </LoggerClass>

</logger>

 

For more information, see the SAP EP Java API documentation.

 

 

Leaving content frame