Class SessionLogsToFileRepository
- java.lang.Object
-
- org.openqa.selenium.remote.server.log.SessionLogsToFileRepository
-
public class SessionLogsToFileRepository extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description SessionLogsToFileRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createLogFileAndAddToMap(org.openqa.selenium.remote.SessionId sessionId)
This creates log file object which represents logs in file form.void
flushRecordsToLogFile(org.openqa.selenium.remote.SessionId sessionId, java.util.List<java.util.logging.LogRecord> records)
This creates a mapping between session and file representation of logs if doesnt exist already.java.util.List<java.util.logging.LogRecord>
getLogRecords(org.openqa.selenium.remote.SessionId sessionId)
This returns the log records storied in the corresponding log file.void
removeLogFile(org.openqa.selenium.remote.SessionId sessionId)
-
-
-
Method Detail
-
createLogFileAndAddToMap
public void createLogFileAndAddToMap(org.openqa.selenium.remote.SessionId sessionId) throws java.io.IOException
This creates log file object which represents logs in file form. This opens ObjectOutputStream which is used to write logRecords to log file and opens a ObjectInputStream which is used to read logRecords from the file.- Parameters:
sessionId
- session-id for the log file entry needs to be created.- Throws:
java.io.IOException
- file i/o exception can occur because of a temp file created
-
flushRecordsToLogFile
public void flushRecordsToLogFile(org.openqa.selenium.remote.SessionId sessionId, java.util.List<java.util.logging.LogRecord> records) throws java.io.IOException
This creates a mapping between session and file representation of logs if doesnt exist already. Writes the log records to the log file. This does *NOT* flush the logs to file. This does *NOT* clear the records after writing to file.- Parameters:
sessionId
- session-id to which the log records belongrecords
- logRecords that need to be stored- Throws:
java.io.IOException
- file i/o exception can occur because of a temp file created
-
getLogRecords
public java.util.List<java.util.logging.LogRecord> getLogRecords(org.openqa.selenium.remote.SessionId sessionId) throws java.io.IOException
This returns the log records storied in the corresponding log file. This does *NOT* clear the log records in the file.- Parameters:
sessionId
- session-id for which the file logs needs to be returned.- Returns:
- A List of LogRecord objects, which can be null.
- Throws:
java.io.IOException
- IO exception can occur with reading the log file
-
removeLogFile
public void removeLogFile(org.openqa.selenium.remote.SessionId sessionId)
-
-