Logs logs = driver.manage().logs(); LogEntries logEntries = logs.get(LogType.DRIVER); for (LogEntry logEntry : logEntries) { System.out.println(logEntry.getMessage()); }
LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER); for (LogEntry entry : logEntries) { System.out.println(new Date(entry.getTimestamp()) + " " + entry.getLevel() + " " + entry.getMessage());
private String buildMessage(final LogEntry entry) { final StringBuilder sb = new StringBuilder(); sb.append("[").append(entry.getBundle()).append("] ").append(entry.getMessage()); return sb.toString(); }
LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER); for (LogEntry entry : logEntries) { System.out.println(new Date(entry.getTimestamp()) + " " + entry.getLevel() + " " + entry.getMessage());
List<LogEntry> logEntries = driver.manage().logs().get("logcat").getAll(); for (LogEntry entry : logEntries) { if (entry.getMessage().contains(event)) { // System.out.println("Found the logs looking for."); } }
for (LogEntry entry : driver.manage().logs().get(LogType.PERFORMANCE)) { if(entry.getMessage().contains("Network.dataReceived")) { Matcher dataLengthMatcher = Pattern.compile("encodedDataLength\":(.*?),").matcher(entry.getMessage()); dataLengthMatcher.find(); //Do whatever you want with the data here. }
private StringBuilder formatMessage(LogEntry entry, StringBuilder out) { String msg = entry.getMessage(); if (msg != null) { formatString(msg, out); } return out; }
public void logged(LogEntry entry) { log(entry.getMessage()); } }
private static void warn(final LogEntry entry) { final String name = entry.getBundle().getSymbolicName(); final String message = entry.getMessage(); final Throwable ex = entry.getException(); if (ex != null) { SLF4JLogReader.LOG.warn("[{}]: {}: ", name, message, ex); } else { SLF4JLogReader.LOG.warn("[{}]: {}", name, message); } }
private static void info(final LogEntry entry) { final String name = entry.getBundle().getSymbolicName(); final String message = entry.getMessage(); final Throwable ex = entry.getException(); if (ex != null) { SLF4JLogReader.LOG.info("[{}]: {}: ", name, message, ex); } else { SLF4JLogReader.LOG.info("[{}]: {}", name, message); } }
private static void error(final LogEntry entry) { final String name = entry.getBundle().getSymbolicName(); final String message = entry.getMessage(); final Throwable ex = entry.getException(); if (ex != null) { SLF4JLogReader.LOG.error("[{}]: {}: ", name, message, ex); } else { SLF4JLogReader.LOG.error("[{}]: {}", name, message); } }
DesiredCapabilities d = DesiredCapabilities.chrome(); LoggingPreferences logPrefs = new LoggingPreferences(); logPrefs.enable(LogType.PERFORMANCE, Level.ALL); d.setCapability(CapabilityType.LOGGING_PREFS, logPrefs); WebDriver driver = new ChromeDriver(d); driver.get("http://www.google.com"); LogEntries les = driver.manage().logs().get(LogType.PERFORMANCE); for (LogEntry le : les) { System.out.println(le.getMessage()); }
void log(Bundle bundle, ServiceReference<?> sr, int level, String message, Throwable exception) { LogEntry le = new LogEntryImpl(bundle, sr, exception, level, message); synchronized (this) { entries.add(le); if (logToConsole != null) { logToConsole.format("%8s: %s %s %s\n", le.getTime(), le.getMessage(), le.getServiceReference(), le.getException()); } } }
void log(Bundle bundle, ServiceReference<?> sr, int level, String message, Throwable exception) { LogEntry le = new LogEntryImpl(bundle, sr, exception, level, message); synchronized (this) { entries.add(le); if (logToConsole != null) { logToConsole.format("%8s: %s %s %s\n", le.getTime(), le.getMessage(), le.getServiceReference(), le.getException()); } } }
public void reportLog(LogEntry logEntry) { System.out.println("Log(" + logEntry.getTime() + "): " + logEntry.getLevel() + " " + logEntry.getMessage()); if (logEntry.getException() != null) { logEntry.getException().printStackTrace(); } }
public void logged(LogEntry entry) { if (!(entry instanceof ExtendedLogEntry)) // TODO this should never happen return; ExtendedLogEntry extended = (ExtendedLogEntry) entry; Object context = extended.getContext(); if (context instanceof FrameworkLogEntry) { log((FrameworkLogEntry) context); return; } // OK we are now in a case where someone logged a normal entry to the real LogService log(new FrameworkLogEntry(getFwkEntryTag(entry), convertSeverity(entry.getLevel()), 0, entry.getMessage(), 0, entry.getException(), null)); }
public void logged(LogEntry entry) { if (!(entry instanceof ExtendedLogEntry)) // TODO this should never happen return; ExtendedLogEntry extended = (ExtendedLogEntry) entry; Object context = extended.getContext(); if (context instanceof FrameworkLogEntry) { log((FrameworkLogEntry) context); return; } // OK we are now in a case where someone logged a normal entry to the real LogService log(new FrameworkLogEntry(getFwkEntryTag(entry), convertSeverity(entry.getLevel()), 0, entry.getMessage(), 0, entry.getException(), null)); }
public void logged(LogEntry entry) { if (!(entry instanceof ExtendedLogEntry)) // TODO this should never happen return; ExtendedLogEntry extended = (ExtendedLogEntry) entry; Object context = extended.getContext(); if (context instanceof FrameworkLogEntry) { log((FrameworkLogEntry) context); return; } // OK we are now in a case where someone logged a normal entry to the real LogService log(new FrameworkLogEntry(getFwkEntryTag(entry), convertSeverity(entry.getLevel()), 0, entry.getMessage(), 0, entry.getException(), null)); }
public void logged(LogEntry entry) { if (!(entry instanceof ExtendedLogEntry)) // TODO this should never happen return; ExtendedLogEntry extended = (ExtendedLogEntry) entry; Object context = extended.getContext(); if (context instanceof FrameworkLogEntry) { log((FrameworkLogEntry) context); return; } // OK we are now in a case where someone logged a normal entry to the real LogService log(new FrameworkLogEntry(getFwkEntryTag(entry), convertSeverity(entry.getLevel()), 0, entry.getMessage(), 0, entry.getException(), null)); }
public void logged(LogEntry entry) { if (!(entry instanceof ExtendedLogEntry)) // TODO this should never happen return; ExtendedLogEntry extended = (ExtendedLogEntry) entry; Object context = extended.getContext(); if (context instanceof FrameworkLogEntry) { log((FrameworkLogEntry) context); return; } // OK we are now in a case where someone logged a normal entry to the real LogService log(new FrameworkLogEntry(getFwkEntryTag(entry), convertSeverity(entry.getLevel()), 0, entry.getMessage(), 0, entry.getException(), null)); }