public class FileLogger extends Object implements ILogger
Learn more
The example demonstrates a typical usage of the class.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments\\";
String query = "Einstein";
String logPath = "c:\\Log.txt";
IndexSettings settings = new IndexSettings();
settings.setLogger(new FileLogger(logPath, 4.0)); // Specifying the path to the log file and a maximum length of 4 MB
Index index = new Index(indexFolder, settings); // Creating an index in the specified folder
index.add(documentsFolder); // Indexing documents from the specified folder
SearchResult result = index.search(query); // Search in index
Constructor and Description |
---|
FileLogger(String filePath,
double maxSize)
Initializes a new instance of the
FileLogger class. |
Modifier and Type | Method and Description |
---|---|
void |
error(String message)
Logs an error that occurred in the index.
|
String |
getFilePath()
Gets the log file path.
|
double |
getMaxSize()
Gets the maximum size of log file in megabytes.
|
void |
trace(String message)
Logs an event that occurred in the index.
|
public FileLogger(String filePath, double maxSize)
FileLogger
class.filePath
- The log file path.maxSize
- The maximum size of the log file in megabytes.
The value must be in the range from 0.1 to 1000.public final void error(String message)
public final void trace(String message)
public final String getFilePath()
public final double getMaxSize()