How to turn on Logging for OWB 11.2 Design Client

OWB 11.2 adopts one of the widely used logging API: the JavaTM Logging APIs to handle log messages. The JavaTM Logging APIs are introduced in package java.util.logging, whose central goal is to support maintaining and servicing software at customer sites. With this built-in logging system, user can define OWB client logging with a configuration file that will be read at startup, such as defining delivering plain text or XML-formatted log records to the console or to a file.

Where does the configuration file locate?

On Linux there is a text file called "logging.properties" under directory "<owb installation path>/owb/bin/" when OWB is installed. Copy "logging.properties" to "<owb installation path>/owb/bin/admin/", and change the file name to "owbclient.logging.properties". The same for Windows, copy "<owb installation path>\owb\bin\logging.properties" to "<owb installation path>\owb\bin\admin\", and change the file name to "owbclient.logging.properties".

This .properties file establishes the configuration of the logger as you desire. It is a text file in standard java.util.Properties format, with each line in format as "<key>=<value>". Any changes in this file like adding a new parameter will take effect next time you startup OWB.

How to configure the file?

In the .properties file, you can specify "handlers" which export the logs to different places (to the console or a file), "messageFormat" of each handler (to format the output) and "levels" at many different points (so you only see messages of certain priorities), and you can even specify these options on a per-package or per-class basis.

Here is an example file:

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

console.messageFormat={2}

file.message Format={1,time}:{2}

.level = INFO

sun.level = OFF

oracle.level = ALL

java.util.logging.FileHandler.pattern = %h/java%u.log

java.util.logging.FileHandler.limit = 50000

java.util.logging.FileHandler.count = 1

java.util.logging.FileHandler.level = ALL

java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

java.util.logging.ConsoleHandler.level = CONFIG

java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

Let us consider what each line in the configuration file is doing.

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

Messages are sent to a FileHandler that writes log messages to a file and to a ConsoleHandler where messages are exported to the console.

console.messageFormat={2}

Messages output to the console consist of just the message.

 file.messageFormat={1,time}:{2}

Messages sent to the log file include the time a message was logged along with the message.

 .level = INFO

Set the root logger's level to INFO. This is the default level for all loggers. By setting the level of the root logger we ensure that all other loggers inherit that level except for the ones we set otherwise.

 sun.level = OFF

Messages logged by sun.* loggers will be filtered.

 oracle.level = ALL

Messages logged by oracle.* loggers will not be filtered (all).

 java.util.logging.FileHandler.pattern = %h/java%u.log

Set output file name. In this case the log file is placed in user's home directory as "~/java0.log" on Linux, and something like "C:\Documents and Settings\<username>\java0.log" on Windows, depending on Windows version and configurations. Pattern can consist of: %h - user's home directory, %t - temporary directory, %u - a unique identifier, %g - file count.

 java.util.logging.FileHandler.limit = 50000

Limit size of output file in bytes to 50000.

java.util.logging.FileHandler.count = 1

This is the number of output files to cycle through, by appending an integer to the base file name.

 java.util.logging.FileHandler.level = ALL

Override of global logging level. Define level for FileHandler to ALL, which means all messages will be written into log file.

java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

Messages sent to log file are XML-formatted.

 java.util.logging.ConsoleHandler.level = CONFIG

Override of global logging level. Set level for ConsoleHandler to CONFIG, which means messages with level CONFIG or higher will be exported to the console.

 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

Messages output to the console are in plain text format

Let's go into details of this configuration file.

  • Handlers

The handler defines how the message is exported. For example, write them to the console or log them to a file. There are two standard handlers that are available, java.util.logging.FileHandler and java.util.logging.ConsoleHandler. In the following example a FileHandler is added which exports log messages to a file.

handlers=java.util.logging.FileHandler

  • MessageFormat

The messageFormat defines how the message is formatted. Each logging handler can have a messageFormat associated with it. The format can contain the following:

{0} = level being logged

{1} = date/time of logged message

{2} = the log message

{3} = the 'class' that is logging the message

{4} = the 'method' that is logging the message

For example if you set file.messageFormat={1,date} {1,time}: {0} {2}, messages printed to log file will be in format as

Nov 17, 2009 6:54:59 AM: DEBUG_ALL Initializing the backend controllers.

Nov 17, 2009 6:54:59 AM: DEBUG_ALL Controller Initializer: oracle.wh.repos.pdl.APIController

Nov 17, 2009 6:54:59 AM: DEBUG_ALL JVM LIMIT DISABLED: 256M

Nov 17, 2009 6:55:00 AM: DEBUG_ALL Thread[Thread-2,5,main]CacheMediator.init:

  • Formatters

Possible formatters are SimpleFormatter which means printing message in a human readable format, and XMLFormatter which means printing into a standard XML format. For example output messages to console in plain text format by setting

java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

  • Levels

A level describes the lowest logging level of the message to process. Possible values in descending order are SEVERE, WARNING, INFO, DEBUG_CUSTOM, DEBUG_VERBOSE, DEBUG_ALL, CONFIG, FINE, FINER, FINEST. In addition there are two levels: OFF that can be used to turn off logging, and ALL to enable logging of all messages. You can set level SEVERE to ConsoleHandler with command

Java.util.logging.ConsoleHandler.level = SEVERE

Enabling logging at a given level also enables logging at all higher levels. For example, if you set level to INFO, then logged message of level INFO or higher will be output, while those lower will be filtered out.

Level can be applied at either handler or at the class name level, which means that you can control what the lowest level for output for a handler is, along with controlling the lowest level for output for a class name. For example you can set level of FileHandler to CONFIG, meanwhile set level of messages output from class oracle.owb.mapping.map to ALL by

java.util.logging.FileHandler.level = CONFIG

oracle.owb.mapping.map.level = ALL

For detailed settings and complete use of JavaTM Logging APIs see the JDK reference for java.util.logging.

Things to consider when setting the log parameters

Using logging in an application benefits in many ways, such as logging can generate detailed information about the operation, which helps support staff with troubleshooting. However, logging does not come without costs. For example, logging adds runtime overhead from generating log messages and from device I/O, also if logs are too verbose or badly formatted, extracting information from them can be difficult. Then how to log efficiently?

  • Properly set logging level.

The lower the level is, the more messages will be logged. For example level SEVERE indicates just logging serious failures, while ALL indicates that all messages should be logged.

  • Turn off logging output from the packages you are not interested in.

For example if you are only interested in logging output from the "oracle.owb.mapping" package, you could do the following:

.level=OFF

oracle.owb.mapping.level=ALL

  • Turn off System.out.

The OWB Logger 'intercepts' the System.out stream and 're-routes' them as "DEBUG_CUSTOM" messages. So you can use the same mechanism to control how much System.out stuff you want to see. If you set the level on a logger to "CONFIG" or lower, you will see the System.out stuff, if you set it to INFO or higher, it will not be displayed.

You can completely disable this interception process by adding

System.out.level = OFF

More examples

Logging configuration can be modified for different target uses. For example if you only want to capture serious problems or common problems that can be fixed or tracked locally, such as running out of resources or simple configuration errors, you can set default level to SEVERE, or you need a log file sent to support for troubleshooting, then add a FileHandler and set its level to DEBUG_ALL to log more detailed information on the internal execution.

An example of configuration file with which only serious problems are captured:

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

.level = SEVERE

file.messageFormat = {1,date} {1,time}: {2}

java.util.logging.FileHandler.pattern = %h/java%u.log

java.util.logging.FileHandler.limit = 50000

java.util.logging.FileHandler.count = 1

java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

An example of configuration file with which detailed information will be logged for troubleshooting:

handlers = java.util.logging.FileHandler

.level = DEBUG_ALL

file.messageFormat = {1,date} {1,time}: {0} {2}

java.util.logging.FileHandler.pattern = %h/java%u.log

java.util.logging.FileHandler.limit = 50000

java.util.logging.FileHandler.count = 1

java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

ETL, CDC, Real-Time DI and Data Quality for the Oracle Database from the inside.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today