Introduction to MapViewer 1-25
MapperConfig
1.5.2.1 Specifying Logging Information
MapViewer provides a flexible logging mechanism to record run-time information and events. You can configure the granularity, volume, format, and destination of the log
output. You can also configure the maximum size of log files as well as automatic log file rotation.
There are two ways to configure MapViewer’s logging, the container-controlled approach and legacy logging using the logging element in the configuration file:
■
Container-controlled logging: Use Oracle Fusion Middleware 10gR3 Control if MapViewer is deployed to an Oracle Fusion Middleware 10gR3 instance, or
directly edit the OC4J_HOMEj2eehomeconfigj2ee-logging.xml file if MapViewer is deployed to a standalone OC4J instance. This approach takes full
advantage of the Fusion Middleware 10gR3 diagnostic logging mechanisms and allows such advanced features such as maximum log file size and log file rotation.
■
Legacy logging: Involves using the logging element in the mapViewerConfig.xml file. When MapViewer is deployed to WebLogic Server,
legacy logging is the only supported way of configuring MapViewer logging behavior.
Container-Controlled Logging
To configure MapViewer logging when it is deployed to an OC4J 11g standalone instance, edit the OC4J_HOMEj2eehomeconfigj2ee-logging.xml file. For
example, the following code in that file logs all messages from MapViewer at the FINEST level to the default OC4J log file
j2eehomelogoc4jdiagnostic.log:
log_handler name=oc4j-handler class=oracle.core.ojdl.logging.ODLHandlerFactory
property name=path value=..logoc4j property name=maxFileSize value=10485700
property name=maxLogSize value=1048576 property name=encoding value=UTF-8
property name=supplementalAttributes value=J2EE_APP.name,J2EE_ MODULE.name,WEBSERVICE.name,WEBSERVICE_PORT.name
log_handler
The preceding code defines the default OC4J log handler. It specifies where the log file will be saved, its maximum file size, and other information. A log handler like this can
be associated with multiple actual loggers that are created by OC4J components and applications such as MapViewer.
The following example associates a MapViewer logger, in this case one that is responsible for generating all internal log messages, with the preceding log handler:
Note: For container-controlled logging to work, you must comment
out or remove the logging element in the mapViewerConfig.xml file. By default that element is commented
out disabled, so that container-controlled logging settings will function properly. If you enable the logging element even if you
make no other changes to its attributes, then the container-controlled logging settings are ignored by MapViewer.
1-26 Oracle Fusion Middleware Users Guide for Oracle MapViewer
logger name=oracle.mapviewer.logger level=FINEST useParentHandlers=false handler name=oc4j-handler
logger
The preceding example tells OC4J that all log records produced by the logger named oracle.mapviewer.logger should be handled by the log handler named
oc4j-handler. It sets the logging level to FINEST so that all messages generated by MapViewer will be visible in the log file. The possible logging levels supported here
are the following standard Java logging levels: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, and FINEST.
The following loggers are used by MapViewer for container-controlled logging:
■
oracle.mapviewer.logger is used by all server side components of MapViewer to generate diagnostic records.
■
oracle.mapviewer.access is used by MapViewer for logging only user access records.
The preceding example associated an existing log handler named oc4j-handler, which is already defined in the j2ee-logging.xml file. You can also define your
own log handler in the j2ee-logging.xml file and specify a different log file location and name, as well as the maximum file size and the file rotation. The
following example creates a new log handler to store only MapViewer access records:
log_handler name=mv-handler class=oracle.core.ojdl.logging.ODLHandlerFactory property name=path value=..logmapaccessaccess.log
property name=maxFileSize value=600000 property name=maxLogSize value=10000
property name=format value=ODL-TEXT property name=encoding value=UTF-8
property name=supplementalAttributes value=J2EE_APP.name log_handler
The following example associates this new log handler to the MapViewer access logger named oracle.mapviewer.access:
logger name=oracle.mapviewer.access level=FINEST useParentHandlers=false handler name=mv-handler
logger
Note that the level must be FINEST or FINER in order for the access log messages to appear in the log file. Now, if you restart OC4J and make map requests, you should see
a new log file access.log in the OC4J logmapaccess directory that contains records of users accessing MapViewer.
For more information about logging configuration, specifically how to configure logging using Fusion Middleware 10gR3 Control, see Oracle Containers for J2EE
Configuration and Administration Guide
Legacy Logging If you do not use container-controlled logging, you can use the legacy approach, which
is to uncomment-out and modify the logging element in the MapViewer configuration file.
You can specify the following information as attributes or subelements of the logging element:
■
The log_level attribute controls the levels of information that are recorded in the log, which in turn affect the log output volume. Set the log_level attribute
value to one of the following, listed from most restrictive logging to least
Introduction to MapViewer 1-27
restrictive logging: FATAL, ERROR, WARN, INFO, DEBUG, and FINEST. The FATAL level outputs the least log information only unrecoverable events are logged, and
the other levels are progressively more inclusive, with the FINEST level causing the most information to be logged. For production work, a level of WARN or more
restrictive ERROR or FATAL is recommended; however, for debugging you may want to set a less restrictive level.
■
The log_thread_name attribute controls whether or not to include the name of the thread that encountered and logged the event.
■
The log_time attribute controls whether or not the current time is included when a logging event occurs.
■
The log_output subelement identifies output for the logging information. By default, log records are written to the system error console. You can change this to
the system output console or to one or more files, or some combination. If you specify more than one device through multiple log_output subelements, the
logging records are sent to all devices, using the same logging level and attributes.
1.5.2.2 Specifying Map File Storage and Life Cycle Information