protected void log ( SessionId sessionId , String commandName , Object toLog , When when ) { if ( ! logger . isLoggable ( level ) ) { return ; } String text = String . valueOf ( toLog ) ; if ( commandName . equals ( DriverCommand . EXECUTE_SCRIPT ) || commandName . equals ( DriverCommand . EXECUTE_ASYNC_SCRIPT ) ) { if ( text . length ( ) > 100 && Boolean . getBoolean ( "webdriver.remote.shorten_log_messages" ) ) { text = text . substring ( 0 , 100 ) + "..." ; } } switch ( when ) { case BEFORE : logger . log ( level , "Executing: " + commandName + " " + text ) ; break ; case AFTER : logger . log ( level , "Executed: " + text ) ; break ; case EXCEPTION : logger . log ( level , "Exception: " + text ) ; break ; default : logger . log ( level , text ) ; break ; } }
Override this to be notified at key points in the execution of a command .