public void start(String[] args) throws Exception { PropertiesManager pm = new PropertiesManager(new File(propFile)); jrds.JrdsLoggerConfiguration.configure(pm); System.getProperties().setProperty("java.awt.headless", "true"); System.getProperties().putAll(pm); HostsList hl = new HostsList(pm); logger.debug("Scanning dir"); for(Timer t: hl.getTimers()) { t.collectAll(); } }
@Override public void start(String[] args) throws Exception { System.setProperty("java.awt.headless", "true"); jrds.JrdsLoggerConfiguration.initLog4J(); Properties pm = new Properties(); File propFile = new File(propFileName); if(propFile.isFile()) pm.load(new FileReader(propFile)); pm.setProperty("withjmx", "yes"); jrds.Configuration.configure(pm); jrds.JrdsLoggerConfiguration.configure(jrds.Configuration.get().getPropertiesManager()); if(jrds.Configuration.get().getPropertiesManager().withjmx) { doJmx(jrds.Configuration.get().getPropertiesManager()); Management.register(propFile); } // Make it wait on himself to wait forever try { Thread.currentThread().join(); System.out.print("joined"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
propFile = args[0]; PropertiesManager pm = new PropertiesManager(new File(propFile)); jrds.JrdsLoggerConfiguration.configure(pm);
JrdsLoggerConfiguration.configure(this); } catch (IOException e1) { logger.error("Unable to set log file to " + this.logfile + ": " + e1);
@Test public void testOutsideConfiguration() throws IOException { LogManager.getLoggerRepository().resetConfiguration(); ta.setName(TANAME); JrdsLoggerConfiguration.jrdsAppender = ta; Logger.getRootLogger().addAppender(ta); JrdsLoggerConfiguration.initLog4J(); Assert.assertNotNull(LogManager.getLoggerRepository().exists("jrds")); PropertiesManager pm = Tools.makePm(testFolder, "loglevel=error"); JrdsLoggerConfiguration.configure(pm); Logger l = Logger.getLogger("jrds"); l.error("A message"); l.debug("A debug message"); Assert.assertEquals(2, logs.size()); }
@Test public void testConfiguration() throws IOException { LogManager.getLoggerRepository().resetConfiguration(); JrdsLoggerConfiguration.initLog4J(); Logger jrdsLogger = LogManager.getLoggerRepository().exists("jrds"); Assert.assertNotNull(jrdsLogger); PropertiesManager pm = Tools.makePm(testFolder, "loglevel=warn"); JrdsLoggerConfiguration.configure(pm); Assert.assertEquals(pm.loglevel, jrdsLogger.getLevel()); }