Skip to content

How to turn off htmlunit logging? #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
php-coder opened this issue Jan 25, 2017 · 1 comment
Closed

How to turn off htmlunit logging? #85

php-coder opened this issue Jan 25, 2017 · 1 comment

Comments

@php-coder
Copy link

php-coder commented Jan 25, 2017

I didn't found how to turn off htmlunit logging. At this moment it produces a lot of noise:

ERROR] runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://127.0.0.1:8080/public/jquery/1.9.1/jquery.min.js] line=[4] lineSource=[null] lineOffset=[0]
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.3.7/css/bootstrap.min.css' [5:56298] Error in expression; ':' found after identifier "progid".
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.3.7/css/bootstrap.min.css' [5:113847] Error in expression; ':' found after identifier "progid".
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.3.7/css/bootstrap.min.css' [5:114390] Error in expression; ':' found after identifier "progid".
[WARNING] CSS error: 'http://127.0.0.1:8080/public/bootstrap/3.3.7/css/bootstrap.min.css' [5:115558] Invalid color "#000\9".
[ERROR] runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://127.0.0.1:8080/public/jquery/1.9.1/jquery.min.js] line=[4] lineSource=[null] lineOffset=[0]

I have src/test/resources/logback-test.xml file where these messages are turned off but htmlunit doesn't use this file.

How to manage logging for htmlunit in this case?

@php-coder
Copy link
Author

An update in case it can be helpful to someone else:

The loglevel is set and managed by Maven. Here is the details: https://maven.apache.org/maven-logging.html It uses slf4j and SimpleLogger by default. In order to suppress annoying htmlunit messages, I passed the following options:

-Dorg.slf4j.simpleLogger.log.com.gargoylesoftware.htmlunit.DefaultCssErrorHandler=error
-Dorg.slf4j.simpleLogger.log.com.gargoylesoftware.htmlunit.html.InputElementFactory=warn
-Dorg.slf4j.simpleLogger.log.com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl=error

In order to use them always and by default, I put these lines into .m2/jvm.config file within a project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant