AgentUtils { public static void changeRoboconfLogLevel( String logLevel, String etcDir ) throws IOException { if( ! Utils.isEmptyOrWhitespaces( etcDir )) { File f = new File( etcDir, AgentConstants.KARAF_LOG_CONF_FILE ); if( f.exists()) { Properties props = Utils.readPropertiesFile( f ); props.put( "log4j.logger.net.roboconf", logLevel + ", roboconf" ); Utils.writePropertiesFile( props, f ); } } } private  AgentUtils(); static boolean isValidIP( String ip ); static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent ); static void executeScriptResources( File scriptsDir ); static void deleteInstanceResources( Instance instance ); static void changeRoboconfLogLevel( String logLevel, String etcDir ); static Map<String,byte[]> collectLogs( String karafData ); static String findIpAddress( String networkInterface ); static void injectConfigurations(
			String karafEtc,
			String applicationName,
			String scopedInstancePath,
			String domain,
			String ipAddress ); static final String INJECTED_CONFIGS_DIR; }
@Test public void testChangeRoboconfLogLevel() throws Exception { AgentUtils.changeRoboconfLogLevel( Level.FINE.toString(), null ); File karafEtc = this.folder.newFolder(); Assert.assertEquals( 0, karafEtc.listFiles().length ); AgentUtils.changeRoboconfLogLevel( Level.FINE.toString(), karafEtc.getAbsolutePath()); Assert.assertEquals( 0, karafEtc.listFiles().length ); File configFile = new File( karafEtc, "org.ops4j.pax.logging.cfg" ); Assert.assertTrue( configFile.createNewFile()); Assert.assertEquals( 0, configFile.length()); AgentUtils.changeRoboconfLogLevel( Level.FINE.toString(), karafEtc.getAbsolutePath()); String content = Utils.readFileContent( configFile ); Assert.assertTrue( content.contains( Level.FINE.toString() + ", roboconf" )); AgentUtils.changeRoboconfLogLevel( Level.SEVERE.toString(), karafEtc.getAbsolutePath()); content = Utils.readFileContent( configFile ); Assert.assertTrue( content.contains( Level.SEVERE.toString() + ", roboconf" )); Assert.assertFalse( content.contains( Level.FINE.toString() + ", roboconf" )); }