You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of this doesn't do anything and could be completely removed, but I think a lot of Selenium users currently have vestigial references to logging that don't do anything. Rather than figuring out what would and wouldn't break, I'm just throwing a deprecation on everything.
Eventually all of this will go away once we have BiDi enabled.
💡 Additional Considerations
I think we keep the user facing methods in Selenium 5 just deprecated, but can probably remove all the implementation code.
🔄 Types of changes
Cleanup (formatting, renaming)
PR Type
Enhancement
Description
Mark logging classes and methods as deprecated with forRemoval=true
Update RemoteLogs to handle deprecated log types gracefully
Modify tests to verify deprecated behavior returns empty results
Objective: To prevent the leakage of sensitive system information through error messages while providing sufficient detail for internal debugging.
Status: Stacktrace in warnings: The new warning log for omitted remote profiler logs logs the caught exception e, which may expose internal details if application logs are user-visible.
Referred Code
LOG.log(
Level.WARNING, "Remote profiler logs are not available and have been omitted.", e);
}
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive information like PII, PHI, or cardholder data.
Status: Exception logged: The new LOG.log(Level.WARNING, ..., e) may emit stack traces and potentially sensitive runtime details depending on downstream log configuration and handlers.
Referred Code
LOG.log(
Level.WARNING, "Remote profiler logs are not available and have been omitted.", e);
}
Deprecate the entire user-facing logging API, including driver.manage().logs(), Logs, and LogEntries, to clearly signal that the feature is obsolete and will be removed.
Examples:
Solution Walkthrough:
Before:
// In org.openqa.selenium.WebDriver.Options
public interface Options {
// The main entry point to the logging API is not deprecated.
Logs logs();
// ...
}
// In org.openqa.selenium.logging.Logs
// The main interface for log retrieval is not deprecated.
public interface Logs {
LogEntries get(String logType);
Set<String> getAvailableLogTypes();
}
// In org.openqa.selenium.logging.LogEntries
// The class holding log entries is not deprecated.
public class LogEntries implements Iterable<LogEntry> { //...
}
After:
// In org.openqa.selenium.WebDriver.Options
public interface Options {
/**
* @deprecated The W3C WebDriver specification does not support logging.
* This will be removed in a future release.
*/
@Deprecated(forRemoval = true)
Logs logs();
// ...
}
// In org.openqa.selenium.logging.Logs
@Deprecated(forRemoval = true)
public interface Logs { //...
}
// In org.openqa.selenium.logging.LogEntries
@Deprecated(forRemoval = true)
public class LogEntries implements Iterable<LogEntry> { //...
}
Suggestion importance[1-10]: 8
__
Why: This is a valid and significant suggestion that addresses the overall deprecation strategy, proposing a more complete and clearer approach for users by deprecating the entire public logging API.
Medium
General
Avoid confusing deprecation warnings
Move the deprecation warning for CLIENT and PROFILER log types to only be logged when empty logs are returned, avoiding confusion when the old functionality is still active.
@Override
@SuppressWarnings("deprecation")
public LogEntries get(String logType) {
if (LogType.CLIENT.equals(logType)) {
+ if (localLogs != null) {+ return getLocalEntries(logType);+ }
LOG.warning(
"LogType.CLIENT is deprecated and not part of the W3C WebDriver specification. "
+ "Returning empty log entries.");
- if (localLogs != null) {- return getLocalEntries(logType);- }
return new LogEntries(Collections.emptyList());
}
if (LogType.PROFILER.equals(logType)) {
- LOG.warning(- "LogType.PROFILER is deprecated and not part of the W3C WebDriver specification. "- + "Returning empty log entries.");
if (localLogs != null) {
LogEntries remoteEntries = new LogEntries(new ArrayList<>());
try {
remoteEntries = getRemoteEntries(logType);
} catch (WebDriverException e) {
// An exception may be thrown if the WebDriver server does not recognize profiler logs.
// In this case, the user should be able to see the local profiler logs.
LOG.log(
Level.WARNING, "Remote profiler logs are not available and have been omitted.", e);
}
return LogCombiner.combine(remoteEntries, getLocalEntries(logType));
}
+ LOG.warning(+ "LogType.PROFILER is deprecated and not part of the W3C WebDriver specification. "+ + "Returning empty log entries.");
return new LogEntries(Collections.emptyList());
}
if (LogType.SERVER.equals(logType)) {
LOG.warning(
"LogType.SERVER is deprecated. Selenium Grid no longer supports server logs. "
+ "Returning empty log entries.");
return new LogEntries(Collections.emptyList());
}
return getRemoteEntries(logType);
}
Apply / Chat
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies that the deprecation warning is logged even when the old functionality is executed, which is confusing. The proposed change improves the logic by showing the warning only when the new behavior (returning empty logs) is triggered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
We removed a lot of this functionality in the Selenium 4 upgrade to Grid, without marking the methods as deprecated.
The tests for logging have been completely guarded so nothing has been running
Pretty much the only thing that works is what chromedriver supports: https://github.com/bayandin/chromedriver/blob/2ef5f580eeb49ae992f4ad4c9fada75614212d85/logging.h#L30-L33
💥 What does this PR do?
🔧 Implementation Notes
A lot of this doesn't do anything and could be completely removed, but I think a lot of Selenium users currently have vestigial references to logging that don't do anything. Rather than figuring out what would and wouldn't break, I'm just throwing a deprecation on everything.
Eventually all of this will go away once we have BiDi enabled.
💡 Additional Considerations
I think we keep the user facing methods in Selenium 5 just deprecated, but can probably remove all the implementation code.
🔄 Types of changes
PR Type
Enhancement
Description
Mark logging classes and methods as deprecated with forRemoval=true
Update RemoteLogs to handle deprecated log types gracefully
Modify tests to verify deprecated behavior returns empty results
Add @SuppressWarnings annotations to suppress deprecation warnings
File Walkthrough
15 files
Add deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocDeprecate CLIENT, PROFILER, and SERVER log typesAdd deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocAdd deprecation annotation and javadocDeprecate setLocalLogs method with suppressionsDeprecate setLocalLogs method with suppressions1 files
Handle deprecated log types and add null-safe LocalLogs1 files
Extract LocalLogs initialization with deprecation handling5 files
Add deprecation suppression to logging testUpdate tests to verify deprecated log types return emptyAdd deprecation suppression and test commentUpdate test to verify deprecated profiler logs return emptyUpdate tests for deprecated log type behavior