How to turn off the Marionette/gecko driver logs in selenium 3

Tried the following code, but didn't work. Seems like a bug in selenium 3.0

    LoggingPreferences pref = new LoggingPreferences();
    pref.enable(LogType.BROWSER, Level.OFF);
    pref.enable(LogType.CLIENT, Level.OFF);
    pref.enable(LogType.DRIVER, Level.OFF);
    pref.enable(LogType.PERFORMANCE, Level.OFF);
    pref.enable(LogType.PROFILER, Level.OFF);
    pref.enable(LogType.SERVER, Level.OFF);


    DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
    desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, pref);

    WebDriver driver = new FirefoxDriver(desiredCapabilities);

    driver.get("https://www.google.com/");
    driver.findElement(By.id("lst-ib")).sendKeys("something");
    Thread.sleep(2000);
    driver.quit();

You can disable the logs by sending them to /dev/null via a system property like so:

System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"/dev/null");

return new FirefoxDriver();

Working solution on Windows and Linux.

# python 3

# windows
PATH_TO_DEV_NULL = 'nul'
FIREFOX_DRIVER_PATH = 'D:\\path\\to\\geckodriver.exe'

# linux
PATH_TO_DEV_NULL = '/dev/null'
FIREFOX_DRIVER_PATH = '/path/to/geckodriver'

# start browser
driver = webdriver.Firefox(executable_path=FIREFOX_DRIVER_PATH,
                           service_log_path=PATH_TO_DEV_NULL)