title: ChromeDriver Unable to add Performance Logging in Selenium Java
body: <p>I have looked at the web search results and answers on stackoverflow on this topic but I couldn't find anyone having same issue. Following is code to enable performance logging that I am using:</p>
  
  <pre><code>    ChromeOptions options = new ChromeOptions();
  
      // options.addArguments("--headless");
      options.addArguments("--remote-debugging-port=9222");
      options.addArguments("--no-sandbox");
      options.addArguments("--disable-application-cache");
      options.addArguments("--disable-notifications");
      options.addArguments("--disable-dev-shm-usage");
      options.addArguments("--disable-extensions");
      options.addArguments("--test-type");
      options.addArguments("start-maximized");
      options.addArguments("disable-infobars");
      //options.addArguments("user-data-dir=C:\\apps\\selenium\\chrome\\data");
      options.setExperimentalOption("useAutomationExtension", false);
      options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
  
      // add Network logging
      LoggingPreferences logPrefs = new LoggingPreferences();
      logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
      options.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
  
      Map&lt;String, Object&gt; perfLogPrefs = new HashMap&lt;String, Object&gt;();
      perfLogPrefs.put("enableNetwork", true);
      perfLogPrefs.put("traceCategories", "devtools.network");
      options.setExperimentalOption("perfLoggingPrefs", perfLogPrefs);
  
      webDriver = new ChromeDriver(options);
  
      webDriver.manage().deleteAllCookies();
      webDriver.manage().window().maximize();
  </code></pre>
  
  <p>When executed, it gives following error:</p>
  
  <pre><code>    Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port 27252
      Only local connections are allowed.
      Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
  org.openqa.selenium.InvalidArgumentException: invalid argument: entry 0 of 'firstMatch' is invalid
  from invalid argument: perfLoggingPrefs specified, but performance logging was not enabled
  Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03
  </code></pre>
  
  <p>What am I missing in above? The code examples use ChromeDriver(Capabilities) but that is deprecated. Is there some other setting that I need to enable before adding performance logging?</p>
  
  <p>Thanks</p>