alma::acs::logging::tools::LogFileSplitter Class Reference

Inheritance diagram for alma::acs::logging::tools::LogFileSplitter:
Inheritance graph
[legend]
Collaboration diagram for alma::acs::logging::tools::LogFileSplitter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LogFileSplitter (String[] inputFiles, String outputFiles, Integer num, Integer mins, LogConverter converter)
void split () 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

BufferedWriter getOutputFile (String dest, int idx, Date startingDate)
void closeOutputFile (BufferedWriter file)

Private Attributes

String[] inFileNames
String destFileName
int index = 0
Integer number = null
Integer time = null
int logsRead = 0
long firstLogDate = -1
final int OUTPUT_BUFFER_SIZE = 8192
BufferedWriter outF = null
SimpleDateFormat dateFormat = new IsoDateFormat()
final LogConverter converter

Detailed Description

An object to split a log file in several other shorter file. The criteria is the number of logs or the time (in minutes)

A progressive number is appended to the name of the destination for each created file. If the time is the criteria to split the input file, the the date of the first log is appended to the name of the file too.

Author:
acaproni

Constructor & Destructor Documentation

alma::acs::logging::tools::LogFileSplitter::LogFileSplitter ( String[]  inputFiles,
String  outputFiles,
Integer  num,
Integer  mins,
LogConverter  converter 
) [inline]

Constructor

Parameters:
inputFiles The files of log to read
outputFiles The names of the files created splitting
num The number of logs per file (can be null)
mins The minutes of the logs per file (can be null)
converter The converter to format the logs before saving

References destFileName, inFileNames, number, and time.


Member Function Documentation

void alma::acs::logging::tools::LogFileSplitter::bytesRead ( long  bytes  )  [inline]
void alma::acs::logging::tools::LogFileSplitter::bytesWritten ( long  bytes  )  [inline]
void alma::acs::logging::tools::LogFileSplitter::closeOutputFile ( BufferedWriter  file  )  [inline, private]

Flush and close the file

Parameters:
file The file to close

Referenced by logEntryReceived(), and split().

void alma::acs::logging::tools::LogFileSplitter::errorReceived ( String  xml  )  [inline]
BufferedWriter alma::acs::logging::tools::LogFileSplitter::getOutputFile ( String  dest,
int  idx,
Date  startingDate 
) [inline, private]

Create a new file for output.

Parameters:
dest The name of the destination file
index The index to append to the name
startingDate The date of the first log to append to the name of the file It can be null.
Returns:
The writer for output

References converter, dateFormat, and OUTPUT_BUFFER_SIZE.

Referenced by logEntryReceived().

void alma::acs::logging::tools::LogFileSplitter::logEntryReceived ( ILogEntry  logEntry  )  [inline]
void alma::acs::logging::tools::LogFileSplitter::logsRead ( int  numOfLogs  )  [inline]
void alma::acs::logging::tools::LogFileSplitter::logsWritten ( int  numOfLogs  )  [inline]
void alma::acs::logging::tools::LogFileSplitter::split (  )  throws Exception [inline]

Split the input file

Exceptions:
Exception in case of errors while splitting

References closeOutputFile(), inFileNames, alma::acs::logging::engine::io::IOHelper::loadLogs(), and outF.

Referenced by alma::acs::logging::tools::LogAssistant::splitFile().


Member Data Documentation

The converter to format the log before saving

Referenced by getOutputFile(), and logEntryReceived().

The format of the date in the name of the file

Referenced by getOutputFile().

The name for the output files

A progressive number/starting date is appended at the end of each name

Referenced by logEntryReceived(), and LogFileSplitter().

The date of the first log in the current output file (needed for time criteria)

Referenced by logEntryReceived().

The progressive number appended at the end of each generated file

Referenced by logEntryReceived().

The name of the input files

Referenced by LogFileSplitter(), and split().

Counts the number of logs read (needed for number criteria)

Referenced by logEntryReceived().

The number of logs in each splitted file

Referenced by logEntryReceived(), and LogFileSplitter().

BufferedWriter alma::acs::logging::tools::LogFileSplitter::outF = null [private]

The writer to write the destination files

Referenced by logEntryReceived(), and split().

The size of the buffer for writing

Referenced by getOutputFile().

The time frame of the logs in each splitted file (in msec)

Referenced by logEntryReceived(), and LogFileSplitter().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2