Protractor: loggingPrefs not respected - always INFO logging

Created on 18 Aug 2015  路  17Comments  路  Source: angular/protractor

I'm starting protractor with the following config. Specifically, these capabilities:

  capabilities: {
    'browserName': 'firefox',

    'loggingPrefs': {
      'driver': 'WARNING',
      'server': 'WARNING',
      'browser': 'WARNING'
    }
  },

Yet, when I run my tests, I'm still getting a ton of INFO logs (log dump). Specifically, the most verbose logs are from an executeScript call.

When I start using ./node_modules/.bin/protractor --troubleshoot, I see the following in the output:

DEBUG - WebDriver session successfully started with capabilities { caps_: 
   { applicationCacheEnabled: true,
     rotatable: false,
     handlesAlerts: true,
     databaseEnabled: true,
     version: '40.0',
     platform: 'LINUX',
     nativeEvents: false,
     acceptSslCerts: true,
     'webdriver.remote.sessionid': '49993575-e0ba-4e87-b93b-e5ae8371d3b3',
     webStorageEnabled: true,
     locationContextEnabled: true,
     browserName: 'firefox',
     takesScreenshot: true,
     javascriptEnabled: true,
     cssSelectorsEnabled: true } }

Note, there's no loggingPrefs object.

Someone opened a similar issue in https://github.com/angular/protractor/issues/2315, and from what I can tell, they were also using some variant of executeScript.

This is currently making it very difficult to debug Travis failures as my logs are exceeding 4MB (the limit).

feature request

Most helpful comment

is this fixed? I can't change logging level for my protractor tests. It is always INFO. I use jasmine, chrome as a browser and webdriver-manager.

All 17 comments

@sjelin would you mind chiming in?

If right here you add console.log(this.config_.capabilities);, what do you see?

Got curious, looks like an external bug. Filed one myself: https://github.com/SeleniumHQ/selenium/issues/983

Will keep working on a work-around.

Tried to solve the problem with a firefox profile but it didn't work. I might be misusing the feature though - I'm not sure. Nothing more I can do until the selenium people come through.

Per https://github.com/SeleniumHQ/selenium/issues/983 it sounds like the issue is in protractor. Is that correct? If so, any ETA on a fix?

If you're using webdriver-manager to spawn your selenium server then it is indeed a Protractor issue. Since you're in a rush, for a work-around, I'd suggest adding

args.push('-Djava.util.logging.config.file="logging.properties"');

right above this line, where logging.properties is a file that contains:

.level = WARNING

@sjelin I think you should provide a convenient way to pass 'logging.properties' file, e.g. via configuration file instead of hard-coding in 'webdriver-manager' code.

Yeah, I mean, currently webdriver-manager doesn't allow for config files. And the config file you pass to protractor can't communicate to webdriver-manager. So it's unclear exactly how this feature should look. But there should definitely be something.

Just to make sure I understand this correctly... After this is fixed, will the [launcher] logging go away?

screen shot 2016-04-11 at 11 14 22 pm

right above this line, where logging.properties is a file that contains:

@sjelin Did you mean this line? When I followed your link from https://github.com/angular/protractor/issues/2436#issuecomment-143212957, I got this line (from the master branch at time of writing).

The line you linked is

 * delete the old version.

as part of

/**
 * If a new version of the file with the given url exists, download and
 * delete the old version.
 */

If so, can you edit your comment please? For more info, see y here: https://help.github.com/articles/using-keyboard-shortcuts/#source-code-browsing

@sjelin Your link in https://github.com/angular/protractor/issues/2436#issuecomment-135688608 is also broken for the same reason: it's referencing master, not a commit hash of the time

is this fixed? I can't change logging level for my protractor tests. It is always INFO. I use jasmine, chrome as a browser and webdriver-manager.

Could someone provide an example of how to implement this?

This worked for me...

webdriver-manager start --logging /absolute/path/to/logging.properties

logging.properties looked like...

handlers=java.util.logging.ConsoleHandler
org.level=WARNING

I couldn't figure out what class names all the logging was coming from so I just applied it to all org.* classes.

@darrinholst

I tried your solution with org.level=ALL and got the below output when restarting webdriver-manager, so I'm assuming it was correctly started with the configured log level?

when I run my test suite (protractor protractor.conf.modular.js --suite=e2e), the console output and spec/results.xml log output still look the same as before, so doesn't look like the log level changed.

how do I know if the configured log level really took affect, where do I need to look/check?

thanks in advance!

sudo webdriver-manager start --logging ~/projects/web_static/automation.log-level
[09:35:29] I/start - java -Djava.util.logging.config.file=/Users/user/projects/web_static/automation.log-level -Dwebdriver.gecko.driver=/Users/user/.nvm/versions/node/v6.9.4/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.20.1 -Dwebdriver.chrome.driver=/Users/user/.nvm/versions/node/v6.9.4/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.38 -jar /Users/user/.nvm/versions/node/v6.9.4/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.11.0.jar -port 4444
[09:35:29] I/start - seleniumProcess.pid: 24416
09:35:30.300 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.11.0', revision: 'e59cfb3'
09:35:30.303 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2018-05-01 09:35:30.471:INFO::main: Logging initialized @521ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:35:30.664 INFO [SeleniumServer.boot] - Welcome to Selenium for Workgroups....
09:35:30.665 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 444

Any update on the fix?

Was this page helpful?
0 / 5 - 0 ratings