public class DefaultPerSessionLogHandler extends PerSessionLogHandler
| Modifier and Type | Class and Description |
|---|---|
private static class |
DefaultPerSessionLogHandler.ThreadKey |
| Modifier and Type | Field and Description |
|---|---|
private int |
capacity |
private java.util.logging.Formatter |
formatter |
private SessionLogsToFileRepository |
logFileRepository |
private java.util.Map<org.openqa.selenium.remote.SessionId,java.util.Map<java.lang.String,org.openqa.selenium.logging.LogEntries>> |
perSessionDriverEntries |
private java.util.Map<org.openqa.selenium.remote.SessionId,java.util.List<java.util.logging.LogRecord>> |
perSessionRecords |
private java.util.Map<DefaultPerSessionLogHandler.ThreadKey,java.util.List<java.util.logging.LogRecord>> |
perThreadTempRecords |
private java.util.logging.Level |
serverLogLevel |
private java.util.Map<org.openqa.selenium.remote.SessionId,DefaultPerSessionLogHandler.ThreadKey> |
sessionToThreadMap |
private boolean |
storeLogsOnSessionQuit |
private java.util.Map<DefaultPerSessionLogHandler.ThreadKey,org.openqa.selenium.remote.SessionId> |
threadToSessionMap |
| Constructor and Description |
|---|
DefaultPerSessionLogHandler(int capacity,
java.util.logging.Level minimumLevel,
java.util.logging.Formatter formatter,
boolean captureLogsOnQuit)
New handler keeping track of log records per session.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachToCurrentThread(org.openqa.selenium.remote.SessionId sessionId) |
void |
clearThreadTempLogs()
Clears the logging events attached to the thread.
|
void |
close() |
void |
configureLogging(org.openqa.selenium.logging.LoggingPreferences prefs)
Configures logging using a logging preferences object.
|
void |
detachFromCurrentThread() |
void |
fetchAndStoreLogsFromDriver(org.openqa.selenium.remote.SessionId sessionId,
org.openqa.selenium.WebDriver driver)
Fetches and stores available logs from the given session and driver.
|
void |
flush() |
private java.lang.String |
formattedRecords(org.openqa.selenium.remote.SessionId sessionId) |
org.openqa.selenium.logging.SessionLogs |
getAllLogsForSession(org.openqa.selenium.remote.SessionId sessionId)
Gets all logs for a session.
|
java.lang.String |
getLog(org.openqa.selenium.remote.SessionId sessionId)
This returns Selenium Remote Control logs associated with the sessionId.
|
java.util.List<org.openqa.selenium.remote.SessionId> |
getLoggedSessions()
Returns a list of session IDs for which there are logs.
|
org.openqa.selenium.logging.LogEntries |
getSessionLog(org.openqa.selenium.remote.SessionId sessionId)
Returns the server log for the given session id.
|
void |
publish(java.util.logging.LogRecord record) |
private java.util.logging.LogRecord[] |
records(org.openqa.selenium.remote.SessionId sessionId) |
void |
removeSessionLogs(org.openqa.selenium.remote.SessionId sessionId)
Removes session logs for the given session id.
|
void |
transferThreadTempLogsToSessionLogs(org.openqa.selenium.remote.SessionId sessionId) |
private final java.util.Map<org.openqa.selenium.remote.SessionId,java.util.List<java.util.logging.LogRecord>> perSessionRecords
private final java.util.Map<org.openqa.selenium.remote.SessionId,java.util.Map<java.lang.String,org.openqa.selenium.logging.LogEntries>> perSessionDriverEntries
private final java.util.Map<DefaultPerSessionLogHandler.ThreadKey,java.util.List<java.util.logging.LogRecord>> perThreadTempRecords
private final java.util.logging.Formatter formatter
private java.util.Map<DefaultPerSessionLogHandler.ThreadKey,org.openqa.selenium.remote.SessionId> threadToSessionMap
private java.util.Map<org.openqa.selenium.remote.SessionId,DefaultPerSessionLogHandler.ThreadKey> sessionToThreadMap
private SessionLogsToFileRepository logFileRepository
private int capacity
private boolean storeLogsOnSessionQuit
private java.util.logging.Level serverLogLevel
public DefaultPerSessionLogHandler(int capacity,
java.util.logging.Level minimumLevel,
java.util.logging.Formatter formatter,
boolean captureLogsOnQuit)
capacity - The capacityminimumLevel - Only keep track of records whose level is equal or greater than
minimumLevel.formatter - Formatter to use when retrieving log messages.captureLogsOnQuit - Whether to enable log capture on quit.public void publish(java.util.logging.LogRecord record)
publish in class PerSessionLogHandlerpublic void flush()
flush in class java.util.logging.Handlerpublic void close()
throws java.lang.SecurityException
close in class java.util.logging.Handlerjava.lang.SecurityExceptionprivate java.util.logging.LogRecord[] records(org.openqa.selenium.remote.SessionId sessionId)
throws java.io.IOException
java.io.IOExceptionprivate java.lang.String formattedRecords(org.openqa.selenium.remote.SessionId sessionId)
throws java.io.IOException
java.io.IOExceptionpublic void attachToCurrentThread(org.openqa.selenium.remote.SessionId sessionId)
attachToCurrentThread in class PerSessionLogHandlerpublic void transferThreadTempLogsToSessionLogs(org.openqa.selenium.remote.SessionId sessionId)
transferThreadTempLogsToSessionLogs in class PerSessionLogHandlerpublic void detachFromCurrentThread()
detachFromCurrentThread in class PerSessionLogHandlerpublic void removeSessionLogs(org.openqa.selenium.remote.SessionId sessionId)
removeSessionLogs in class PerSessionLogHandlersessionId - The session id to use.public void clearThreadTempLogs()
clearThreadTempLogs in class PerSessionLogHandlerpublic java.lang.String getLog(org.openqa.selenium.remote.SessionId sessionId)
throws java.io.IOException
getLog in class PerSessionLogHandlersessionId - session-id for which the RC logs will be returned.java.io.IOException - when the elves go badpublic org.openqa.selenium.logging.LogEntries getSessionLog(org.openqa.selenium.remote.SessionId sessionId)
throws java.io.IOException
getSessionLog in class PerSessionLogHandlersessionId - The session id.java.io.IOException - If there was a problem reading from file.public java.util.List<org.openqa.selenium.remote.SessionId> getLoggedSessions()
getLoggedSessions in class PerSessionLogHandlerpublic org.openqa.selenium.logging.SessionLogs getAllLogsForSession(org.openqa.selenium.remote.SessionId sessionId)
getAllLogsForSession in class PerSessionLogHandlersessionId - The id of the session.public void fetchAndStoreLogsFromDriver(org.openqa.selenium.remote.SessionId sessionId,
org.openqa.selenium.WebDriver driver)
throws java.io.IOException
fetchAndStoreLogsFromDriver in class PerSessionLogHandlersessionId - The id of the session.driver - The driver to get the logs from.java.io.IOException - If there was a problem reading from file.public void configureLogging(org.openqa.selenium.logging.LoggingPreferences prefs)
configureLogging in class PerSessionLogHandlerprefs - The logging preferences object.