if(log4jconfigFile != null) { try { cl.createArgument().setValue("-Dlog4j.configuration=" + log4jconfigFile.toURL().toExternalForm()); } catch ( MalformedURLException e ) {  }
String log4jConfig = getLog4jConfigFile(); if(log4jConfig != null) { cl.createArgument().setValue("-Dlog4j.configuration=" + log4jConfig);
    protected int executeJava()        throws MojoExecutionException    {        Commandline cl = new Commandline();        cl.setExecutable( "java" );        cl.createArgument().setValue( "-cp" );        cl.createArgument().setValue( createClasspath() );                if(log4jconfigFile != null) {            try            {                cl.createArgument().setValue("-Dlog4j.configuration=" + log4jconfigFile.toURL().toExternalForm());            }            catch ( MalformedURLException e )            {                // ignore            }        }                cl.createArgument().setValue( "-Xmx" + maxmem );        cl.createArgument().setValue( this.taskClass );                if ( this.cmdLineArgs.useCommandsFile() )        {            cl.createArgument().setValue( "--commandsfile" );            try            {                String commandsFile = this.cmdLineArgs.getCommandsFile();                cl.createArgument().setValue( commandsFile );                FileUtils.copyFile( new File( commandsFile ), new File( commandsFile + ".bak" ) );            }            catch ( IOException e )            {                throw new MojoExecutionException( "Unable to obtain CommandsFile location.", e );            }        }        else        {            Iterator it = this.cmdLineArgs.iterator();            while ( it.hasNext() )            {                cl.createArgument().setValue( it.next().toString() );            }        }        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();        // TODO: drop these to debug level.        getLog().info( "Working Directory: " + cl.getWorkingDirectory() );        getLog().info( "Executing command line:" );        getLog().info( cl.toString() );        int exitCode;        try        {            exitCode = CommandLineUtils.executeCommandLine( cl, stdout, stderr );        }        catch ( CommandLineException e )        {            throw new MojoExecutionException( "Unable to execute Cobertura.", e );        }        getLog().debug( "exit code: " + exitCode );        getLog().debug( "--------------------" );        getLog().debug( " Standard output from the Cobertura task:" );        getLog().debug( "--------------------" );        getLog().info( stdout.getOutput() );        getLog().debug( "--------------------" );        String stream = stderr.getOutput();        if ( stream.trim().length() > 0 )        {            getLog().debug( "--------------------" );            getLog().debug( " Standard error from the Cobertura task:" );            getLog().debug( "--------------------" );            getLog().error( stderr.getOutput() );            getLog().debug( "--------------------" );        }        return exitCode;    }