{"record":{"id":"fd0b807733a1b6d8","repo":"SeleniumHQ/selenium","slug":"safari-service-does-not-support-setting-log-output","errorCode":null,"errorMessage":"Safari Service does not support setting log output","messagePattern":"Safari Service does not support setting log output","errorType":"exception","errorClass":"Error::WebDriverError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/safari/service.rb","lineNumber":29,"sourceCode":"#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\nmodule Selenium\n  module WebDriver\n    module Safari\n      class Service < WebDriver::Service\n        DEFAULT_PORT = 7050\n        EXECUTABLE = 'safaridriver'\n        SHUTDOWN_SUPPORTED = false\n        DRIVER_PATH_ENV_KEY = 'SE_SAFARIDRIVER'\n        def initialize(path: nil, port: nil, log: nil, args: nil)\n          raise Error::WebDriverError, 'Safari Service does not support setting log output' if log\n\n          super\n        end\n\n        def log=(*)\n          raise Error::WebDriverError, 'Safari Service does not support setting log output'\n        end\n      end # Service\n    end # Safari\n  end # WebDriver\nend # Selenium\n","sourceCodeStart":11,"sourceCodeEnd":41,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/safari/service.rb#L11-L41","documentation":"Safari::Service#initialize rejects the log: keyword because safaridriver has no command-line flag for redirecting its log output to a file, unlike chromedriver/geckodriver. The binding refuses the argument up front (if log is truthy) rather than silently ignoring it, so a developer learns immediately that log capture is unsupported for Safari.","triggerScenarios":"Calling Selenium::WebDriver::Safari::Service.new(log: '/tmp/safari.log') or Selenium::WebDriver::Safari::Service.new(log: $stdout), or passing a Service configured with a log: value into a Safari Driver. Any truthy value for the log keyword in the constructor triggers it.","commonSituations":"Sharing a Service-configuration block across browsers that sets log: for all of them; migrating a Chrome test suite to Safari and keeping the log file argument; trying to capture safaridriver diagnostics the same way as other drivers.","solutions":["Remove the log: argument from the Safari::Service initializer.","Branch Service construction per browser so Safari never receives log:.","For Safari diagnostics use `safaridriver` directly from a terminal or macOS Console instead of the Service log option."],"exampleFix":"# before\nservice = Selenium::WebDriver::Safari::Service.new(log: 'safari.log')\n\n# after\nservice = Selenium::WebDriver::Safari::Service.new","handlingStrategy":"validation","validationCode":"# Build Safari service without log:\nservice = Selenium::WebDriver::Safari::Service.new\n# Only add log for drivers that support it:\nservice = Selenium::WebDriver::Chrome::Service.new(log: 'chrome.log') unless browser == :safari","typeGuard":"def supports_service_log?(browser)\n  browser != :safari\nend","tryCatchPattern":"begin\n  service = Selenium::WebDriver::Safari::Service.new(log: path)\nrescue Selenium::WebDriver::Error::WebDriverError => e\n  raise unless e.message.include?('does not support setting log output')\n  service = Selenium::WebDriver::Safari::Service.new\nend","preventionTips":["Never pass log: to Safari::Service.new; branch service construction per browser.","Keep a single browser-aware factory for Service objects so unsupported options are skipped.","Document that safaridriver has no log redirection so teammates don't re-add it."],"tags":["safari","service","logging","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}