|
IBM WebSphere Application ServerTM Release 8 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
GenericFile | Interface representing extension of File requiring special methods for
finding child instances and to return InputStream providing file's content. |
LogRecordFilter | A filter to select log records based on fields available from the RepositoryLogRecord . |
LogRecordHeaderFilter | A filter to select log records based on fields available from the RepositoryLogRecordHeader . |
RemoteListCache | Repository result cache to improve performance of multiple calls |
RepositoryLogRecord | An individual record in the HPEL repository. |
RepositoryLogRecordHeader | The header of an individual record in the HPEL repository. |
RepositoryPointer | A pointer to a location in an HPEL repository. |
RepositoryReader | An interface for reading HPEL repositories. |
ServerInstanceLogRecordList | A list of log records originating from one process. |
Class Summary | |
---|---|
AbstractRemoteRepositoryReader | Abstract implementation of the RepositoryReader for remote reading of log records. |
HpelFormatter | Abstract class for formatters used to convert HPEL log records into a formatted string output. |
LogQueryBean | Simple bean class to hold more static parts of a given query. |
MergedRepository | Helper class to merge separate RepositoryLogRecord collections together. |
RemoteAllResults | Collection of instances satisfying query request. |
RemoteInstanceDetails | Object representing a server instance in a query context. |
RemoteInstanceResult | Result of the query on a server instance. |
RemoteResultCollector | Utility class to collect query results into Serializable form convenient for passing over the wire. |
RepositoryReaderImpl | Implementation of the RepositoryReader providing access to a local HPEL repository. |
Exception Summary | |
---|---|
LogRepositoryException | Checked exception thrown in API methods in case of an error. |
LogRepositoryRuntimeException | Unchecked exception to wrap checked one thrown in methods without 'throws' clause. |
Provides classes and interfaces for reading log records stored in HPEL format.
HPEL repositories store log and trace content in a binary format which requires an API to read. Individual log and trace records are represented by the RepositoryLogRecord interface. A ServerInstanceLogRecordList is a collection of RepositoryLogRecords from one server process. The RepositoryReader interface provides methods for getting a ServerInstanceLogRecordList.
To read a local HPEL repository, use the RepositoryReaderImpl class to query for a ServerInstanceLogRecordList. Iterate over the ServerInstanceLogRecordList to obtain the contained RepositoryLogRecord instances. Additionally, information related to all log records in the server process is accessible from properties via the ServerInstanceLogRecordList's getHeader method. This information is what would often be displayed in a log file's header.
As an example, to print out all of the records in a log repository located in the directory "repositoryLocation" use the following code:
RepositoryReaderImpl reader = new RepositoryReaderImpl("repositoryLocation");
for(ServerInstanceLogRecordList oneServerList: reader.getLogLists()) {
oneServerList.getHeader().list(System.out);
for (RepositoryLogRecord record: oneServerList) {
System.out.println(record.toString());
}
}
While iterating through a ServerInstanceLogRecordList, a RepositoryPointer can be obtained from any RepositoryLogRecord. A RepositoryPointer is a pointer to a location in the repository, and can be used in queries to the RepositoryReader to obtain lists of log records that begin with the record immediately following the location denoted by the RepositoryPointer.
The following example illustrates how to search for a particular message in the repository, then use the RepositoryPointer of that log record as a starting point for a query for warning (or more severe) messages.
RepositoryPointer rp = null;
for(RepositoryLogRecord record: reader.getLogListForCurrentServerInstance()) {
if (record.getMessage().contains("open for e-business")) {
rp = record.getRepositoryPointer();
}
}
if (found != null) {
for (RepositoryLogRecord record: reader.getLogListForServerInstance(rp, Level.WARNING, null)) {
System.out.println(record.toString());
}
}
Advanced filtering can be implemented by using RepositoryReaderImpl methods accepting LogRecordFilter or LogRecordHeaderFilter instances as parameters. Queries which make use of the LogRecordHeaderFilter (which can only utilize fields in the RepositoryLogRecordHeader interface) run more efficiently than queries which make use of a LogRecordFilter (which can utilize fields in the entire RepositoryLogRecord interface). A set of predefined filters can be found in the filters package.
The following example illustrates how to list severe log records or messages written to the standard error stream:
LogRecordFilter filter = new LogRecordFilter() {
public accept(RepositoryLogRecord record) {
return Level.SEVERE.equals(record.getLevel()) || "SystemErr".equals(record.getLoggerName();
}
}
for(RepositoryLogRecord record: reader.getLogListForServerInstance((Date)null, filter)) {
System.out.println(record.toString());
}
|
IBM WebSphere Application ServerTM Release 8 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |