com.ibm.websphere.logging.hpel.reader
Interface RepositoryReader
-
- All Known Implementing Classes:
- AbstractRemoteRepositoryReader, RepositoryReaderImpl
public interface RepositoryReader
An interface for reading HPEL repositories.The getLogLists() methods return lists of log record lists in which the log record (inner) list represents log records generated by one process.
For example, If your repository contains log records from two separate process lifespans, you'll have the following results:
All getLogList* queries have the ability to start from a particular RepositoryLogRecord. This is done by passing to the query method the RepositoryPointer information from that record. Here is an example:for (
ServerInstanceLogRecordList
oneProcessList:getLogLists()
) { // this loop will be executed twice - once for each process lifespan // The header contains information about the serverProperties
header = oneProcessList.getHeader(); for (RepositoryLogRecord
record: oneProcessList) { // This loop iterates over the list of RepositoryLogRecords from one process lifespan. } }
A simple sample of using the reader to report on all logs currently in a server repository:RepositoryPointer pointer; for (
RepositoryLogRecord
record:getLogListForCurrentServerInstance()
) { // process the record if (<this is the record we want to start from next time>) { pointer = record.getRepositoryPointer(); } } // after the break for (RepositoryLogRecord
record: getLogListForServerInstance(last)) { // finish what was started. }
Note that any records added to the repository after the repository reader instance has been created will not be included in the record list.public static void main(String[] args) { // Create a repository reader (requires base directory of repository RepositoryReader logRepository = new RepositoryReaderImpl(args[0]) ; // Get iterator of server instances (start/stop of the server) extracting all log messages with // severity between INFO and SEVERE. Lots of different filtering options, this is just one sample Iterable<ServerInstanceLogRecordList> repResults = logRepository.getLogLists(Level.INFO, Level.SEVERE) ; // Go through each server instance for (ServerInstanceLogRecordList pidRecords: repResults) { // For each list (server lifeCycle) // For each server instance, go through the records for (RepositoryLogRecord repositoryLogRecord : pidRecords) { // Just printing some key information here. Note that the repositoryRecord exposes all fields // with simple get methods System.out.println(" "+repositoryLogRecord.getFormattedMessage()); } } }
-
-
Method Summary
Methods Modifier and Type Method and Description java.io.File
generateLogOutput(LogQueryBean logQueryBean, java.lang.String outputFileName, java.lang.String formatter)
ServerInstanceLogRecordList
getLogListForCurrentServerInstance()
returns log records from the repository that were created since the last server startup.ServerInstanceLogRecordList
getLogListForServerInstance(java.util.Date time)
returns log records from the repository of a server instance running at the time specified.ServerInstanceLogRecordList
getLogListForServerInstance(java.util.Date time, int threadID)
returns log records from the repository of a server instance running at a specified time created by the given thread.ServerInstanceLogRecordList
getLogListForServerInstance(java.util.Date time, java.util.logging.Level minLevel, java.util.logging.Level maxLevel)
returns log records from the repository of a server instance running at a specified time, within the level range as specified.ServerInstanceLogRecordList
getLogListForServerInstance(java.util.Date time, LogQueryBean query)
returns log records from the repository of a server instance running at a specified time, according to the criteria specified by the log query bean.ServerInstanceLogRecordList
getLogListForServerInstance(RepositoryPointer after)
returns log records from the repository that are beyond a given repository location as specified.ServerInstanceLogRecordList
getLogListForServerInstance(RepositoryPointer after, int threadID)
returns log records from the repository that are beyond a given repository location and created by a given thread as specified.ServerInstanceLogRecordList
getLogListForServerInstance(RepositoryPointer after, java.util.logging.Level minLevel, java.util.logging.Level maxLevel)
returns log records from the repository that are beyond a given repository location and within the level range as specified.ServerInstanceLogRecordList
getLogListForServerInstance(RepositoryPointer after, LogQueryBean query)
returns log records from the repository for one server instance that are beyond a given repository location, according to the criteria specified by the log query bean.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists()
returns all log records from the repository.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists(java.util.Date minTime, java.util.Date maxTime)
returns log records from the repository that are within the date range as specified.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists(java.util.logging.Level minLevel, java.util.logging.Level maxLevel)
returns log records from the repository that are within the level range as specified.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists(LogQueryBean query)
returns log records from the repository according to the criteria specified by the log query bean.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists(RepositoryPointer after)
returns all log records from the repository beyond a given repository location as specified.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists(RepositoryPointer after, java.util.Date maxTime)
returns log records from the repository that are beyond a given repository location and occurred before a given time as specified.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists(RepositoryPointer after, java.util.logging.Level minLevel, java.util.logging.Level maxLevel)
returns log records from the repository that are beyond a given repository location and within the level range as specified.java.lang.Iterable<ServerInstanceLogRecordList>
getLogLists(RepositoryPointer after, LogQueryBean query)
returns log records from the repository that are beyond a given repository location, according to the criteria specified by the log query bean.
-
-
-
Method Detail
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists() throws LogRepositoryException
returns all log records from the repository.- Returns:
- the iterable instance of a list of log records within a process
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after) throws LogRepositoryException
returns all log records from the repository beyond a given repository location as specified. Callers need to invokeRepositoryLogRecordHeader.getRepositoryPointer()
to obtain the RepositoryPointer for a particular log record.- Parameters:
after
- pointer to a record the list will start after- Returns:
- the iterable instance of a list of log records within a process. If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists(java.util.logging.Level minLevel, java.util.logging.Level maxLevel) throws LogRepositoryException
returns log records from the repository that are within the level range as specified.- Parameters:
minLevel
- minimumLevel
that will be included in the returned listmaxLevel
- maximumLevel
that will be included in the returned list- Returns:
- the iterable instance of a list of records within a process that are within the parameter range If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, java.util.logging.Level minLevel, java.util.logging.Level maxLevel) throws LogRepositoryException
returns log records from the repository that are beyond a given repository location and within the level range as specified. Callers need to invokeRepositoryLogRecordHeader.getRepositoryPointer()
to obtain the RepositoryPointer for a particular log record.- Parameters:
after
- pointer to a record the list will start afterminLevel
- minimumLevel
that will be included in the returned listmaxLevel
- maximumLevel
that will be included in the returned list- Returns:
- the iterable instance of a list of log records within a process that are within the parameter range If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists(java.util.Date minTime, java.util.Date maxTime) throws LogRepositoryException
returns log records from the repository that are within the date range as specified. The parameters can be null to indicate an open ended range. For example, a caller may passnull
as the maxTime to indicate that the returned log records do not have to meet a maxTime criteria.- Parameters:
minTime
- minimumDate
value that will be included in the returned listmaxTime
- maximumDate
value that will be included in the returned list- Returns:
- the iterable instance of a list of log records within a process that are within the parameter range If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, java.util.Date maxTime) throws LogRepositoryException
returns log records from the repository that are beyond a given repository location and occurred before a given time as specified. Callers need to invokeRepositoryLogRecordHeader.getRepositoryPointer()
to obtain the RepositoryPointer for a particular log record.- Parameters:
after
- pointer to a record the list will start aftermaxTime
- maximumDate
value that will be included in the returned list- Returns:
- the iterable instance of a list of log records within a process that are within the parameter range If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists(LogQueryBean query) throws LogRepositoryException
returns log records from the repository according to the criteria specified by the log query bean.- Parameters:
query
-LogQueryBean
instance representing set of criteria each of which need to be met by the return records.- Returns:
- the iterable instance of a list of log records within a process that are within the parameter range If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogLists
java.lang.Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, LogQueryBean query) throws LogRepositoryException
returns log records from the repository that are beyond a given repository location, according to the criteria specified by the log query bean.- Parameters:
after
- pointer to a record the list will start afterquery
-LogQueryBean
instance representing set of criteria each of which need to be met by the return records.- Returns:
- the iterable instance of a list of log records within a process that are within the parameter range If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading list of instances from the server.
-
getLogListForCurrentServerInstance
ServerInstanceLogRecordList getLogListForCurrentServerInstance() throws LogRepositoryException
returns log records from the repository that were created since the last server startup.- Returns:
- the iterable list of log records If no records meet the criteria, an Iterable is returned with no entries
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(java.util.Date time) throws LogRepositoryException
returns log records from the repository of a server instance running at the time specified.- Parameters:
time
-Date
value used to determine the server instance where the server start time occurs before this value and the server stop time occurs after this value- Returns:
- the iterable list of log records If no records meet the criteria, a list is returned with a null properties object and a null record list
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(RepositoryPointer after) throws LogRepositoryException
returns log records from the repository that are beyond a given repository location as specified. Callers need to invokeRepositoryLogRecordHeader.getRepositoryPointer()
to obtain the RepositoryPointer for a particular log record. The returned logs will be from one server instance.- Parameters:
after
- pointer to a record the list will start after- Returns:
- the iterable list of log records If no records meet the criteria, the list is empty.
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(java.util.Date time, java.util.logging.Level minLevel, java.util.logging.Level maxLevel) throws LogRepositoryException
returns log records from the repository of a server instance running at a specified time, within the level range as specified.- Parameters:
time
-Date
value used to determine the server instance where the server start time occurs before this value and the server stop time occurs after this valueminLevel
- minimumLevel
that will be included in the returned listmaxLevel
- maximumLevel
that will be included in the returned list- Returns:
- the iterable list of log records If no records meet the criteria, the list is empty.
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(RepositoryPointer after, java.util.logging.Level minLevel, java.util.logging.Level maxLevel) throws LogRepositoryException
returns log records from the repository that are beyond a given repository location and within the level range as specified. Callers need to invokeRepositoryLogRecordHeader.getRepositoryPointer()
to obtain the RepositoryPointer for a particular log record. The returned logs will be from one server instance.- Parameters:
after
- pointer to a record the list will start afterminLevel
- minimumLevel
that will be included in the returned listmaxLevel
- maximumLevel
that will be included in the returned list- Returns:
- the iterable list of log records If no records meet the criteria, the list is empty.
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(java.util.Date time, int threadID) throws LogRepositoryException
returns log records from the repository of a server instance running at a specified time created by the given thread.- Parameters:
time
-Date
value used to determine the server instance where the server start time occurs before this value and the server stop time occurs after this valuethreadID
- ID of the thread that the returned records will match- Returns:
- the iterable list of log records If no records meet the criteria, the list is empty.
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(RepositoryPointer after, int threadID) throws LogRepositoryException
returns log records from the repository that are beyond a given repository location and created by a given thread as specified. Callers need to invokeRepositoryLogRecordHeader.getRepositoryPointer()
to obtain the RepositoryPointer for a particular log record. The returned logs will be from one server instance.- Parameters:
after
- pointer to a record the list will start afterthreadID
- ID of the thread that the returned records will match- Returns:
- the iterable list of log records If no records meet the criteria, the list is empty.
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(java.util.Date time, LogQueryBean query) throws LogRepositoryException
returns log records from the repository of a server instance running at a specified time, according to the criteria specified by the log query bean.- Parameters:
time
-Date
value used to determine the server instance where the server start time occurs before this value and the server stop time occurs after this valuequery
-LogQueryBean
instance representing set of criteria each of which need to be met by the return records.- Returns:
- the iterable list of log records If no records meet the criteria, the list is empty.
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.- See Also:
LogQueryBean
-
getLogListForServerInstance
ServerInstanceLogRecordList getLogListForServerInstance(RepositoryPointer after, LogQueryBean query) throws LogRepositoryException
returns log records from the repository for one server instance that are beyond a given repository location, according to the criteria specified by the log query bean.- Parameters:
after
- pointer to a record the list will start afterquery
-LogQueryBean
instance representing set of criteria each of which need to be met by the return records.- Returns:
- the iterable list of log records If no records meet the criteria, the list is empty.
- Throws:
LogRepositoryException
- indicating that an error occurred while reading records from the server.- See Also:
LogQueryBean
-
generateLogOutput
java.io.File generateLogOutput(LogQueryBean logQueryBean, java.lang.String outputFileName, java.lang.String formatter) throws LogRepositoryException
- Throws:
LogRepositoryException
-
-