J Configuring Logging

Logging is the mechanism by which components write messages to a file.

Oracle Adaptive Access Manager 11g components use the package java.util.logging as part of its logging infrastructure. This package is available in all Java environments.

Note:

On a production machine, you want to manage the amount of time logging is enabled since increasing the amount of logging may negatively affect performance.

J.1 Logging Configuration File

Logging is initialized using the default logging configuration file, logging.properties, that is read at startup.

The file is located in the Home directory. It configures the Oracle Adaptive Access Manager Framework loggers to print messages. Through editing this file, you can:

  • Specify the level of detail in the log messages.

  • Specify whether log messages are sent to the console, to a file or to both

  • Specify logging at the level of individual areas for which a logger is defined

J.2 Oracle Adaptive Access Manager Loggers

The OAAM loggers generate logging messages to report on errors, and provide additional information about OAAM. Oracle Adaptive Access Manager Loggers are described in Table J-1.

Table J-1 Oracle Adaptive Access Manager Loggers

Logger Components

oracle.oaam.model

ADF Models package, all classes with package starting with oracle.oaam.model

oracle.oaam.view

ADF View package, all classes with package starting with oracle.oaam.view

oracle.oaam.alerts

Alerts, rules engine specifically uses this logger so that custom handlers can consume these log records

oracle.oaam

root Logger controls all oaam logging


J.3 Logging Levels

The log levels define the importance and urgency of a log message. The class Level is used to define which messages should be written to the log. Log messages have an associated log level. Logging levels in descending order are listed below.

Table J-2 Logging Levels

Level Description

SEVERE

The highest value; intended for extremely important messages (for example, fatal program errors). SEVERE is used to diagnose if there is improper functioning of the system.

WARNING

Intended for warning messages.

INFO

Informational runtime messages. Any logging at INFO and above provides complete details. Any logging message below INFO should have its logging enabled to check for performance reasons (isDebugEnabled() / isLevelEnabled()).

CONFIG

Informational messages about configuration settings/setup.

FINE

Used for greater detail, when debugging/diagnosing problems.

FINER

Even greater detail.

FINEST

The lowest value; greatest detail.

ALL

Enables logging of all records

OFF

Used to turn off logging


Property to Control Logging Level

The following property controls the level of logging:

Logger Name=Level

Enable Debug Log

Example, to enable debug logs:

oracle.oaam.level=FINER

Enable Debug Logs for ADF Models

To enable debug logs for ADF models package and reset all information logging, the following entries may be added:

oracle.oaam.level=INFO
oracle.oaam.model.level=FINER

Configure all logs to use FINER logging (include debug)

To configure oracle.oaam to use FINER logging (include debug)

oracle.oaam.level=FINER

J.4 Handlers

Each logger has access to handlers. The handler receives the log message from the logger and output the log messages to a file or to both.

Appendix J shows the handlers used by Oracle Adaptive Access Manager

Table J-3 Handler Classes

Handler Class Function

FileHandler

Writes formatted log records either to a single file, or to a set of rotating log files.

ConsoleHandler

Writes formatted records to System.err


J.4.1 Configuring the File Handler

To send logs to a file, add FileHandler to the handlers property in the logging.properties file. This will enable file logging globally.

handlers= java.util.logging.FileHandler

Configure the handler by setting the following properties:

java.util.logging.FileHandler.pattern=<home directory>/logs/oaam.log
java.util.logging.FileHandler.limit=50000
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter

java.util.logging.FileHandler.pattern specifies the location and pattern of the output file. The default setting is your home directory.

java.util.logging.FileHandler.limit specifies, in bytes, the maximum amount that the logger writes to any one file.

java.util.logging.FileHandler.count specifies how many output files to cycle through.

java.util.logging.FileHandler.formatter specifies the java.util.logging formatter class that the file handler class uses to format the log messages. SimpleFormatter writes brief "human-readable" summaries of log records.

J.4.2 Configuring Both Console Logging and File Logging

You can set logging to output log messages to both the console and to a file by specifying the console handler and the file handler, separated by a comma, as shown:

handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler

J.5 Redirecting oracle.oaam Logs

To redirect oracle.oaam logs to file handler (oaam.log), set the following property:

oracle.oaam.handlers=java.util.logging.FileHandler

If you want logs to go to both console and file, comment the following property:

oracle.oaam.useParentHandlers=false

To instruct java to use this configuration file instead of $JDK_HOME/jre/lib/logging.properties:

java -Djava.util.logging.config.file=/scratch/user/config/logging.properties