Do you know how can I turn Warnings, Notes, Errors in HtmlUnit off?
相关问题
- Java program to download images from a website and
- How to define (non-method) functions in header lib
- Java ant script does not show warnings
- Is -Wreturn-std-move clang warning correct in case
- R: `ID : Coercing LHS to a list` in adding an ID c
相关文章
- Suppress “Circular dependency detected” suppress w
- How to force Delphi compiler to display all hints
- “Access of shared member, constant member, enum me
- .switchTo().frame(<'frameId'>); not wor
- Getting HtmlUnit to run under Android
- Running HtmlUnit with Jython - issue with startup
- Is this an incorrect warning?
- libpng warning: Ignoring bad adaptive filter type
One option which worked well for me is to change the htmlunit logger to log to a different file just so that I have those errors in case I need to refer it some time and it also doesn't clutter up my main logs. Below is the log4j change I made to log4j.properties:
Arsen.. thanks a lot for the answer .. Using your code helped in removing almost all the logs by HtmlUnit. But one edit helps to remove them all:
Use:
instead of
Try adding this to your code :
Basically, logger logs to NoOpLog which doesn't write log to error or file or anywhere.
now in htmlunit 2.9,WebClient.setCssErrorHandler(new SilentCssErrorHandler()) can conveniently ignore the warnings and errors.
I am using below code and it prefect.
To remove all output from the latest version of HtmlUnit you just have to add these lines in a static block or in your main class:
It is NOT needed to override any method as some other answers state.