

Public Member Functions | |
| LogFileExtractor (String inputFiles[], String outputFile, Date startDate, Date endDate, String filterName, LogConverter converter) throws Exception | |
| void | extract () throws Exception |
| void | bytesRead (long bytes) |
| void | bytesWritten (long bytes) |
| void | logsRead (int numOfLogs) |
| void | logsWritten (int numOfLogs) |
| void | errorReceived (String xml) |
| void | logEntryReceived (ILogEntry logEntry) |
Private Member Functions | |
| void | openDestFile () |
| boolean | checkDate (ILogEntry log) |
Private Attributes | |
| long | start = -1 |
| long | end = -1 |
| String | filterFileName = null |
| FiltersVector | filters = null |
| String[] | inFileNames |
| String | destFileName |
| final int | OUTPUT_BUFFER_SIZE = 8192 |
| BufferedWriter | outF = null |
| final LogConverter | converter |
An object to extract the logs that matches the given criteria. It reads the input file and parse each log and writes in the output all the logs matching the criteria. It is possible to specify a start and/or end date or pass the name of a filter to load. The filters are the same used by jlog so jlog can be used to edit and save such file.
| alma::acs::logging::tools::LogFileExtractor::LogFileExtractor | ( | String | inputFiles[], | |
| String | outputFile, | |||
| Date | startDate, | |||
| Date | endDate, | |||
| String | filterName, | |||
| LogConverter | converter | |||
| ) | throws Exception [inline] |
Constructor The parameters defines the criteria. They can be null (but not all null of course). All the criteria are applied in AND. If the start/end date are not present, the dates are not checked.
| inputFiles | The name of the files of logs for input | |
| outputFile | The name of the file with the selected logs | |
| startDate | The start date of logs (can be null) | |
| endDate | The end date of the logs (can be null) | |
| filterName | The name of a file of filters to apply to select logs (can be null) | |
| converter | The convert to save logs in different output formats |
| <code>Exception</code> | In case of error |
References converter, destFileName, end, filterFileName, filters, inFileNames, com::cosylab::logging::engine::FiltersVector::loadFilters(), and start.
| void alma::acs::logging::tools::LogFileExtractor::bytesRead | ( | long | bytes | ) | [inline] |
| void alma::acs::logging::tools::LogFileExtractor::bytesWritten | ( | long | bytes | ) | [inline] |
| boolean alma::acs::logging::tools::LogFileExtractor::checkDate | ( | ILogEntry | log | ) | [inline, private] |
Check if the date of the log is between the requested start and end date
| log | The log to check |
References end, com::cosylab::logging::engine::log::ILogEntry::getField(), and start.
Referenced by logEntryReceived().
| void alma::acs::logging::tools::LogFileExtractor::errorReceived | ( | String | xml | ) | [inline] |
The method is executed when an error happened building a log from a string.
The parameter is the string that caused the error and it can be
The cache string is a string used in the cache whose format might change with different implementation of of the cache.
| xml | That string that caused the error |
Implements com::cosylab::logging::engine::ACS::ACSRemoteErrorListener.
| void alma::acs::logging::tools::LogFileExtractor::extract | ( | ) | throws Exception [inline] |
Extract the logs from the source to the destination applying the selection criteria given in the constructor
References inFileNames, alma::acs::logging::engine::io::IOHelper::loadLogs(), openDestFile(), and outF.
Referenced by alma::acs::logging::tools::LogAssistant::extractLogs().
| void alma::acs::logging::tools::LogFileExtractor::logEntryReceived | ( | ILogEntry | logEntry | ) | [inline] |
Implements com::cosylab::logging::engine::ACS::ACSRemoteLogListener.
References com::cosylab::logging::engine::FiltersVector::applyFilters(), checkDate(), alma::acs::logging::tools::LogConverter::convert(), converter, end, filters, outF, and start.
| void alma::acs::logging::tools::LogFileExtractor::logsRead | ( | int | numOfLogs | ) | [inline] |
| void alma::acs::logging::tools::LogFileExtractor::logsWritten | ( | int | numOfLogs | ) | [inline] |
| void alma::acs::logging::tools::LogFileExtractor::openDestFile | ( | ) | [inline, private] |
Create the BufferedWriter and the IOHelper for writing logs.
This method uses a new IOHelper to open a new file where the logs are saved into. It sets up:
outHelper outF References destFileName, and outF.
Referenced by extract().
final LogConverter alma::acs::logging::tools::LogFileExtractor::converter [private] |
The converter to format the log before saving
Referenced by logEntryReceived(), and LogFileExtractor().
String alma::acs::logging::tools::LogFileExtractor::destFileName [private] |
The name of the output file
Referenced by LogFileExtractor(), and openDestFile().
long alma::acs::logging::tools::LogFileExtractor::end = -1 [private] |
Referenced by checkDate(), logEntryReceived(), and LogFileExtractor().
String alma::acs::logging::tools::LogFileExtractor::filterFileName = null [private] |
The name of the file of filter
Referenced by LogFileExtractor().
FiltersVector alma::acs::logging::tools::LogFileExtractor::filters = null [private] |
The filters
Referenced by logEntryReceived(), and LogFileExtractor().
String [] alma::acs::logging::tools::LogFileExtractor::inFileNames [private] |
The name of the files for reading
Referenced by extract(), and LogFileExtractor().
BufferedWriter alma::acs::logging::tools::LogFileExtractor::outF = null [private] |
The writer to write the destination files
Referenced by extract(), logEntryReceived(), and openDestFile().
final int alma::acs::logging::tools::LogFileExtractor::OUTPUT_BUFFER_SIZE = 8192 [private] |
The size of the buffer for writing
long alma::acs::logging::tools::LogFileExtractor::start = -1 [private] |
Referenced by checkDate(), logEntryReceived(), and LogFileExtractor().
1.6.2