Applications often need to provide information about their internal
operations to users, system administrators, programmers, and other interested
parties. This information is typically provided as text that can be
sent to a console or terminal, written to a log file, directed to a standard
output or error device, or all three. The JRas toolkit divides
informational text into the following two categories:
- Messages, consisting of information about the application that
is brief, clear, and meaningful to an end user. An example of a message
is a string indicating that the application started successfully.
Messages are generated by default; they are not normally
suppressed. Messages can be localized; that is, the message
catalogs can be translated into various national language versions, and
messages can be displayed in the user's preferred language.
- Trace, consisting of detailed technical information about the
current state of one or more of the application's internal data
structures, including summaries of all objects in those data
structures. Trace information is meant for use by developers and
support personnel when debugging applications; it is not generally
intended for use by end users. An example of trace information is a
string listing an error, the time at which the error occurred, the thread in
which the error occurred, the method that was being executed when the error
occurred, and a description of the error. Trace information is not
normally generated by applications and is enabled only to help resolve
specific problems, because the creation of trace information consumes system
resources beyond the application's normal requirements. Trace is
not localizable; that is, it cannot be translated into national language
versions.
The JRas packages implement objects called loggers,
handlers, formatters, and managers to provide
messaging and trace capabilities. These objects are described in the
following list.
- Loggers are the primary objects with which the application code
interacts.
- Handlers receive data that is to be logged from a
logger.
- Formatters are objects invoked by handlers to format
data.
- Managers provide methods to predefine and manage logger,
handler, and formatter configurations. These configurations can be kept
in a persistent data store. Using managers simplifies programming with
JRas; when a manager is used to obtain a logger, the manager retrieves
the logger's configuration data, creates the logger and populates it with
the correct handlers, performs any other needed tasks, and returns the
configured logger to the caller. The Manager class provided with
WebSphere is WebSphere specific and cannot be used with generic JRas
implementations. Using this class to create and manage WebSphere JRas
objects ensures that all derived objects (loggers, handlers, and formatters)
conform to the requirements of the WebSphere JRas implementation.
To view message and trace text, you must read the appropriate log
files. WebSphere currently logs all messages to single-level log
files; that is, application messages and run-time messages are written to
the same log file. It is recommended that you monitor the size of the
log files and increase the allowable size of the files depending on the number
of messages written to the log. WebSphere also logs all trace events,
whether application trace or run-time trace, to the same trace log
file. All editions of WebSphere Application Server provide facilities
to view message and trace logs; see the documentation for your edition of
WebSphere for more information.