1

I am running into problems properly disabling ALL HtmlUnit logging. I'm not even sure where the information is coming from.

The project code all exists HERE on github.

I see console output like:

HtmlTextInput[<input type="text" class="text_" name="j_username" id="username">] -> HtmlHtml[<html lang="en" class="no-js ie8">]

I've read the logging section of the HtmlUnit docs and I've simplified down to the following which does remove everything except for the HtmlTextInput log listed above.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
    <appender name="NULL" class="org.apache.log4j.varia.NullAppender" />
    <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
        </layout>
    </appender>
    <logger name="com.gargoylesoftware">
        <level value="OFF" />
        <appender-ref ref="NULL" />
    </logger>
    <root>
        <priority value="warn" />
        <appender-ref ref="NULL" />
    </root>
</log4j:configuration>

My commons-logging.properties file looks like:

# JDK Logging
#org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
# Log4j logging (also required log4j.jar to be in classpath)
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

My Pom file contains:

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
    <scope>test</scope>
</dependency>

In addition I've tried suggestions listed in the following places:

http://htmlunit.sourceforge.net/logging.html

http://alexcuesta.wordpress.com/2011/05/11/turning-off-htmlunit-driver-logging-messages/

Turning HtmlUnit Warnings off

Any help is appreciated.

Community
  • 1
  • 1
Y. Adam Martin
  • 368
  • 2
  • 13

1 Answers1

3

I uncovered the answer. It turns out that this is an issue with selenium 2.33 and how it was working with the HtmlUnitDriver because someone left in a hardcoded System.err in the HtmlUnitDriver.java.

The appropriate fix is to upgrade to a newer version of Selenium.

Y. Adam Martin
  • 368
  • 2
  • 13