List of usage examples for java.util.logging Level ALL
Level ALL
To view the source code for java.util.logging Level ALL.
Click Source Link
From source file:com.tri_voltage.md.io.YoutubeVideoParser.java
private static void explicitlySetAllLogging(Level myLevel, Level globalLevel) { rootlog.setLevel(Level.ALL); for (Handler handler : rootlog.getHandlers()) { handler.setLevel(Level.ALL); }/*w w w.j a v a 2s . c o m*/ log.setLevel(myLevel); rootlog.setLevel(globalLevel); }
From source file:ca.sfu.federation.model.Assembly.java
/** * Handle update event./* w w w . j a v a 2s . c o m*/ * @param o Observable object. * @param arg Update argument. */ public void update(Observable o, Object arg) { if (arg instanceof Integer) { Integer eventId = (Integer) arg; switch (eventId) { case ApplicationContext.EVENT_ELEMENT_DELETE_REQUEST: logger.log(Level.ALL, "Assembly fired element delete"); INamed named = (INamed) o; this.remove(named); break; case ApplicationContext.EVENT_PROPERTY_CHANGE: case ApplicationContext.EVENT_UPDATEMETHOD_CHANGE: logger.log(Level.ALL, "Assembly fired local update"); this.update(); this.setChanged(); this.notifyObservers(Integer.valueOf(ApplicationContext.EVENT_ELEMENT_CHANGE)); break; } } }
From source file:test.db_memory.QualitativeTest.java
@Test(dataProvider = "quantitative", groups = "") public static void testBasic(TestDescription test) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException { Logger.getRootLogger().setLevel(org.apache.log4j.Level.ALL); java.util.logging.Logger.getGlobal().setLevel(Level.FINEST); java.util.logging.Logger.getGlobal().setUseParentHandlers(false); Handler newHandler = new ConsoleHandler(); newHandler.setLevel(Level.FINEST); java.util.logging.Logger.getGlobal().addHandler(newHandler); CoreseTimer timerMemory = null;//from w w w .j a v a 2s . c om CoreseTimer timerDb = null; try { setCacheForDb(test); System.gc(); timerDb = CoreseTimer.build(test).setMode(CoreseTimer.Profile.DB).init().run(); System.gc(); timerMemory = CoreseTimer.build(test).setMode(CoreseTimer.Profile.MEMORY).init().run(); } catch (Exception ex) { ex.printStackTrace(); } System.out.println("running test: " + test.getId()); boolean result; try { result = compareResults(timerDb.getMapping(), timerMemory.getMapping()); } catch (Exception ex) { ex.printStackTrace(); result = false; } test.setResultsEqual(result); timerDb.writeResults(); timerDb.writeStatistics(); timerMemory.writeResults(); timerMemory.writeStatistics(); // writeResult(test, timerDb, timerMemory); assertTrue(result, test.getId()); }
From source file:org.jenkinsci.plugins.workflow.WorkflowTest.java
@RandomlyFails("TODO isBuilding assertion after restart occasionally fails; log ends with: Running: Allocate node : Body : Start (no shell step in sight)") @Test//from w w w . j av a 2s.c o m public void buildShellScriptAcrossRestart() throws Exception { story.addStep(new Statement() { @SuppressWarnings("SleepWhileInLoop") @Override public void evaluate() throws Throwable { Logger LOGGER = Logger.getLogger(DurableTaskStep.class.getName()); LOGGER.setLevel(Level.FINE); Handler handler = new ConsoleHandler(); handler.setLevel(Level.ALL); LOGGER.addHandler(handler); // Cannot use regular JenkinsRule.createSlave due to JENKINS-26398. // Nor can we can use JenkinsRule.createComputerLauncher, since spawned commands are killed by CommandLauncher somehow (it is not clear how; apparently before its onClosed kills them off). DumbSlave s = new DumbSlave("dumbo", "dummy", tmp.getRoot().getAbsolutePath(), "1", Node.Mode.NORMAL, "", new JNLPLauncher(), RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList()); story.j.jenkins.addNode(s); startJnlpProc(); p = story.j.jenkins.createProject(WorkflowJob.class, "demo"); File f1 = new File(story.j.jenkins.getRootDir(), "f1"); File f2 = new File(story.j.jenkins.getRootDir(), "f2"); new FileOutputStream(f1).close(); p.setDefinition(new CpsFlowDefinition("node('dumbo') {\n" + " sh 'touch \"" + f2 + "\"; while [ -f \"" + f1 + "\" ]; do sleep 1; done; echo finished waiting; rm \"" + f2 + "\"'\n" + " echo 'OK, done'\n" + "}")); startBuilding(); while (!f2.isFile()) { Thread.sleep(100); } assertTrue(b.isBuilding()); killJnlpProc(); } }); story.addStep(new Statement() { @Override public void evaluate() throws Throwable { rebuildContext(story.j); assertTrue(b.isBuilding()); startJnlpProc(); // Have to relaunch JNLP agent, since the Jenkins port has changed, and we cannot force JenkinsRule to reuse the same port as before. File f1 = new File(story.j.jenkins.getRootDir(), "f1"); File f2 = new File(story.j.jenkins.getRootDir(), "f2"); assertTrue(f2.isFile()); assertTrue(f1.delete()); while (f2.isFile()) { Thread.sleep(100); } story.j.assertBuildStatusSuccess(JenkinsRuleExt.waitForCompletion(b)); story.j.assertLogContains("finished waiting", b); story.j.assertLogContains("OK, done", b); killJnlpProc(); } }); }
From source file:eu.asterics.mw.services.AstericsErrorHandling.java
/** * This method creates the logger. Actually there are 4 types of loggers: * "severe": logs fatal errors i.e. errors that prevent the ARE from functioning * "warning": logs errors other than fatal e.g. component errors * "info": logs informative messages/*from ww w . ja va 2 s. c o m*/ * "fine": logs debugging messages * * Each logger by default also logs all messages with severity level higher than its own. * E.g. the warning logger logs warning and severe messages, the info logger logs info, * warning and severe messages etc. The same applies to the consoleHandler, i.e. by * setting its level to info, the console will also print severe and warning messages * along with info messages */ public Logger getLogger() { if (logger == null) { logger = Logger.getLogger("AstericsLogger"); FileHandler warningFileHandler, severeFileHandler, infoFileHandler, fineFileHandler; ConsoleHandler consoleHandler; try { //cleanup before starting: logger.setUseParentHandlers(false); // remove and handlers that will be replaced Handler[] handlers = logger.getHandlers(); for (Handler handler : handlers) { if (handler.getClass() == ConsoleHandler.class) logger.removeHandler(handler); } File logFolder = new File(System.getProperty(LOG_PATH_PROPERTY, ResourceRegistry.TMP_FOLDER)); if (!logFolder.exists()) { FileUtils.forceMkdir(logFolder); } //Create handlers severeFileHandler = new FileHandler(new File(logFolder, "asterics_logger_severe.log").getPath(), true); warningFileHandler = new FileHandler(new File(logFolder, "asterics_logger_warning.log").getPath(), true); infoFileHandler = new FileHandler(new File(logFolder, "asterics_logger.log").getPath(), true); fineFileHandler = new FileHandler(new File(logFolder, "asterics_logger_fine.log").getPath(), true); consoleHandler = new ConsoleHandler(); //Set report level of handlers severeFileHandler.setLevel(Level.SEVERE); warningFileHandler.setLevel(Level.WARNING); infoFileHandler.setLevel(Level.INFO); fineFileHandler.setLevel(Level.FINE); //The consoleHandler prints log messaged to the console. Its //severety level can be adjusted accordingly. String level = getLoggerLevel(); switch (level) { case "INFO": consoleHandler.setLevel(Level.INFO); break; case "WARNING": consoleHandler.setLevel(Level.WARNING); break; case "FINE": consoleHandler.setLevel(Level.FINE); break; case "SEVERE": consoleHandler.setLevel(Level.SEVERE); break; default: consoleHandler.setLevel(Level.INFO); break; } //Add handlers to the logger logger.addHandler(warningFileHandler); logger.addHandler(severeFileHandler); logger.addHandler(infoFileHandler); logger.addHandler(fineFileHandler); logger.addHandler(consoleHandler); //Create formatters for the handlers (optional) severeFileHandler.setFormatter(new SimpleFormatter()); warningFileHandler.setFormatter(new SimpleFormatter()); infoFileHandler.setFormatter(new SimpleFormatter()); fineFileHandler.setFormatter(new SimpleFormatter()); consoleHandler.setFormatter(new SimpleFormatter()); logger.setLevel(Level.ALL); logger.setUseParentHandlers(false); } catch (SecurityException e) { System.out.println(AstericsErrorHandling.class.getName() + ": Error creating AstericsLogger: " + e.getMessage()); } catch (IOException e) { //logger.warning(this.getClass().getName()+ // ": Error creating AstericsLogger: "+e.getMessage()); System.out.println(AstericsErrorHandling.class.getName() + ": Error creating AstericsLogger: " + e.getMessage()); } } return logger; }
From source file:org.auraframework.test.util.WebDriverTestCase.java
/** * Adds capabilities that request WebDriver performance logs<br/> * See https://sites.google.com/a/chromium.org/chromedriver/logging/performance-log *///from w ww . j a v a2 s. co m private void addPerfCapabilities(DesiredCapabilities capabilities) { if (PerfUtil.hasPerfCmpTestAnnotation(this)) { LoggingPreferences performance_prefs = new LoggingPreferences(); performance_prefs.enable(LogType.PERFORMANCE, Level.ALL); capabilities.setCapability(CapabilityType.LOGGING_PREFS, performance_prefs); Map<String, Object> prefs = new HashMap<>(); prefs.put("traceCategories", "disabled-by-default-devtools.timeline"); ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("perfLoggingPrefs", prefs); capabilities.setCapability(ChromeOptions.CAPABILITY, options); } }
From source file:org.jenkinsci.maven.plugins.hpi.RunMojo.java
public void execute() throws MojoExecutionException, MojoFailureException { getProject().setArtifacts(resolveDependencies(dependencyResolution)); File basedir = getProject().getBasedir(); if (webApp == null || webApp.getContextPath() == null) { if (contextPath != null) { getLog().warn(/* ww w . j a v a2 s . com*/ "Please use `webApp/contextPath` configuration parameter in place of the deprecated `contextPath` parameter"); if (webApp == null) { try { webApp = new JettyWebAppContext(); } catch (Exception e) { throw new MojoExecutionException("Failed to initialize webApp configuration", e); } } webApp.setContextPath(contextPath); } } // compute jenkinsHome if (jenkinsHome == null) { if (hudsonHome != null) { getLog().warn( "Please use the `jenkinsHome` configuration parameter in place of the deprecated `hudsonHome` parameter"); jenkinsHome = hudsonHome; } String h = System.getenv("JENKINS_HOME"); if (h == null) { h = System.getenv("HUDSON_HOME"); } if (h != null) jenkinsHome = new File(h); else jenkinsHome = new File(basedir, "work"); } // auto-enable stapler trace, unless otherwise configured already. setSystemPropertyIfEmpty("stapler.trace", "true"); // allow Jetty to accept a bigger form so that it can handle update center JSON post setSystemPropertyIfEmpty("org.eclipse.jetty.Request.maxFormContentSize", "-1"); // general-purpose system property so that we can tell from Jenkins if we are running in the hpi:run mode. setSystemPropertyIfEmpty("hudson.hpi.run", "true"); // this adds 3 secs to the shutdown time. Skip it. setSystemPropertyIfEmpty("hudson.DNSMultiCast.disabled", "true"); // expose the current top-directory of the plugin setSystemPropertyIfEmpty("jenkins.moduleRoot", basedir.getAbsolutePath()); if (systemProperties != null && !systemProperties.isEmpty()) { for (Map.Entry<String, String> entry : systemProperties.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { System.setProperty(entry.getKey(), entry.getValue()); } } } // look for jenkins.war Artifacts jenkinsArtifacts = Artifacts.of(getProject()) .groupIdIs("org.jenkins-ci.main", "org.jvnet.hudson.main").artifactIdIsNot("remoting"); // remoting moved to its own release cycle webAppFile = getJenkinsWarArtifact().getFile(); // make sure all the relevant Jenkins artifacts have the same version for (Artifact a : jenkinsArtifacts) { Artifact ba = jenkinsArtifacts.get(0); if (!a.getVersion().equals(ba.getVersion())) throw new MojoExecutionException("Version of " + a.getId() + " is inconsistent with " + ba.getId()); } // set JENKINS_HOME setSystemPropertyIfEmpty("JENKINS_HOME", jenkinsHome.getAbsolutePath()); File pluginsDir = new File(jenkinsHome, "plugins"); pluginsDir.mkdirs(); // enable view auto refreshing via stapler setSystemPropertyIfEmpty("stapler.jelly.noCache", "true"); List<Resource> res = getProject().getBuild().getResources(); if (!res.isEmpty()) { // pick up the first one and use it Resource r = res.get(0); setSystemPropertyIfEmpty("stapler.resourcePath", r.getDirectory()); } generateHpl(); // copy other dependency Jenkins plugins try { for (MavenArtifact a : getProjectArtifacts()) { if (!a.isPlugin()) continue; // find corresponding .hpi file Artifact hpi = artifactFactory.createArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion(), null, "hpi"); artifactResolver.resolve(hpi, getProject().getRemoteArtifactRepositories(), localRepository); // check recursive dependency. this is a rare case that happens when we split out some things from the core // into a plugin if (hasSameGavAsProject(hpi)) continue; if (hpi.getFile().isDirectory()) throw new UnsupportedOperationException( hpi.getFile() + " is a directory and not packaged yet. this isn't supported"); File upstreamHpl = pluginWorkspaceMap.read(hpi.getId()); if (upstreamHpl != null) { copyHpl(upstreamHpl, pluginsDir, a.getActualArtifactId()); } else { copyPlugin(hpi.getFile(), pluginsDir, a.getActualArtifactId()); } } } catch (IOException e) { throw new MojoExecutionException("Unable to copy dependency plugin", e); } catch (ArtifactNotFoundException e) { throw new MojoExecutionException("Unable to copy dependency plugin", e); } catch (ArtifactResolutionException e) { throw new MojoExecutionException("Unable to copy dependency plugin", e); } if (loggers != null) { for (Handler h : LogManager.getLogManager().getLogger("").getHandlers()) { if (h instanceof ConsoleHandler) { h.setLevel(Level.ALL); } } loggerReferences = new LinkedList<Logger>(); for (Map.Entry<String, String> logger : loggers.entrySet()) { Logger l = Logger.getLogger(logger.getKey()); loggerReferences.add(l); l.setLevel(Level.parse(logger.getValue())); } } super.execute(); }
From source file:org.auraframework.integration.test.util.WebDriverTestCase.java
/** * Adds capabilities that request WebDriver performance logs<br/> * See https://sites.google.com/a/chromium.org/chromedriver/logging/performance-log *///ww w . ja v a2 s . co m private void addPerfCapabilities(DesiredCapabilities capabilities) { if (PerfUtil.hasPerfCmpTestAnnotation(this)) { // Do not reuse browser capabilities.setCapability(WebDriverProvider.REUSE_BROWSER_PROPERTY, false); LoggingPreferences performance_prefs = new LoggingPreferences(); performance_prefs.enable(LogType.PERFORMANCE, Level.ALL); capabilities.setCapability(CapabilityType.LOGGING_PREFS, performance_prefs); Map<String, Object> prefs = new HashMap<>(); prefs.put("traceCategories", "disabled-by-default-devtools.timeline"); ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("perfLoggingPrefs", prefs); capabilities.setCapability(ChromeOptions.CAPABILITY, options); } }
From source file:edu.usu.sdl.openstorefront.web.rest.service.Application.java
private List<String> loadLevels() { List<String> logLevels = Arrays.asList(Level.OFF.getName(), Level.SEVERE.getName(), Level.WARNING.getName(), Level.CONFIG.getName(), Level.INFO.getName(), Level.FINE.getName(), Level.FINER.getName(), Level.FINEST.getName(), Level.ALL.getName()); return logLevels; }
From source file:org.tigase.messenger.phone.pro.service.XMPPService.java
public XMPPService() { Logger logger = Logger.getLogger("tigase.jaxmpp"); Handler handler = new AndroidLoggingHandler(); handler.setLevel(Level.ALL); logger.addHandler(handler);//from ww w . j av a 2 s.co m logger.setLevel(Level.ALL); }