List of usage examples for java.util.logging Level CONFIG
Level CONFIG
To view the source code for java.util.logging Level CONFIG.
Click Source Link
From source file:org.b3log.latke.plugin.AbstractPlugin.java
/** * Initializes template engine configuration. *//*from w ww . j a v a2 s . co m*/ private void initTemplateEngineCfg() { configuration = new Configuration(); configuration.setDefaultEncoding("UTF-8"); try { configuration.setDirectoryForTemplateLoading(dir); } catch (final IOException e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e); } LOGGER.log(Level.CONFIG, "Initialized template configuration"); }
From source file:org.b3log.latke.servlet.HTTPRequestDispatcher.java
/** * Initializes this servlet.//from w w w . j a va2 s . co m * * <p> * Scans classpath for discovering request processors, configured the 'default' servlet for static resource processing. * </p> * * @throws ServletException servlet exception * @see RequestProcessors#discover() */ @Override public void init() throws ServletException { Stopwatchs.start("Discovering Request Processors"); try { LOGGER.info("Discovering request processors...."); final String scanPath = getServletConfig().getInitParameter("scanPath"); RequestProcessors.discover(scanPath); LOGGER.info("Discovered request processors"); } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Initializes request processors failed", e); } finally { Stopwatchs.end(); } final ServletContext servletContext = getServletContext(); if (servletContext.getNamedDispatcher(COMMON_DEFAULT_SERVLET_NAME) != null) { defaultServletName = COMMON_DEFAULT_SERVLET_NAME; } else if (servletContext.getNamedDispatcher(GAE_DEFAULT_SERVLET_NAME) != null) { defaultServletName = GAE_DEFAULT_SERVLET_NAME; } else if (servletContext.getNamedDispatcher(RESIN_DEFAULT_SERVLET_NAME) != null) { defaultServletName = RESIN_DEFAULT_SERVLET_NAME; } else if (servletContext.getNamedDispatcher(WEBLOGIC_DEFAULT_SERVLET_NAME) != null) { defaultServletName = WEBLOGIC_DEFAULT_SERVLET_NAME; } else if (servletContext.getNamedDispatcher(WEBSPHERE_DEFAULT_SERVLET_NAME) != null) { defaultServletName = WEBSPHERE_DEFAULT_SERVLET_NAME; } else { throw new IllegalStateException("Unable to locate the default servlet for serving static content. " + "Please set the 'defaultServletName' property explicitly."); // TODO: Loads from local.properties } LOGGER.log(Level.CONFIG, "The default servlet for serving static resource is [{0}]", defaultServletName); }
From source file:org.opencms.pdftools.CmsXRLogAdapter.java
/** * Sends a log message to the commons-logging interface.<p> * * @param level the log level//from w ww .j a va 2s .com * @param message the message * @param log the commons logging log object * @param e a throwable or null */ private void sendMessageToLogger(Level level, String message, Log log, Throwable e) { if (e == null) { if (level == Level.SEVERE) { log.error(message); } else if (level == Level.WARNING) { log.warn(message); } else if (level == Level.INFO) { log.info(message); } else if (level == Level.CONFIG) { log.info(message); } else if ((level == Level.FINE) || (level == Level.FINER) || (level == Level.FINEST)) { log.debug(message); } else { log.info(message); } } else { if (level == Level.SEVERE) { log.error(message, e); } else if (level == Level.WARNING) { log.warn(message, e); } else if (level == Level.INFO) { log.info(message, e); } else if (level == Level.CONFIG) { log.info(message, e); } else if ((level == Level.FINE) || (level == Level.FINER) || (level == Level.FINEST)) { log.debug(message, e); } else { log.info(message, e); } } }
From source file:org.csstudio.diirt.util.core.preferences.DIIRTPreferences.java
/** * Verify if the selected path is a valid location for DIIRT configuration: * <ul>// w w w. j a v a 2s . com * <li>path exists.</li> * <li><path contains the {@code datasources/datasources.xml} file.</li> * </ul> * * @param path The path to be verified. * @return {@code null} if the {@code path} is valid, otherwise the error * message explaining why the given {@code path} is not valid. */ public static String resolveAndVerifyDIIRTPath(String path) { if (path == null) { return Messages.DIIRTPreferences_verifyDIIRTPath_nullPath_message; } else if (StringUtils.isBlank(path)) { return Messages.DIIRTPreferences_verifyDIIRTPath_blankPath_message; } else { String beforeResolving = path; try { path = resolvePlatformPath(path); } catch (IOException | NullPointerException | IllegalArgumentException | URISyntaxException ex) { String message = NLS.bind(Messages.DIIRTPreferences_verifyDIIRTPath_resolvingPath_message, path); LOGGER.log(Level.WARNING, MessageFormat.format("{0}\n{1}", message, ExceptionUtilities.reducedStackTrace(ex, "org.csstudio"))); return message; } if (!StringUtils.equals(beforeResolving, path)) { LOGGER.log(Level.CONFIG, "DIIRT home path resolved [before: {0}, after: {1}].", new Object[] { beforeResolving, path }); } if (!Files.exists(Paths.get(path))) { return NLS.bind(Messages.DIIRTPreferences_verifyDIIRTPath_pathNotExists_message, path); } else if (!Files.exists( Paths.get(path, DataSources.DATASOURCES_DIR + File.separator + DataSources.DATASOURCES_FILE))) { return NLS.bind(Messages.DIIRTPreferences_verifyDIIRTPath_pathNotValid_message, path); } } return null; }
From source file:com.speed.ob.Obfuscator.java
private static Level parseLevel(String lvl) { if (lvl.equalsIgnoreCase("info")) { return Level.INFO; } else if (lvl.equalsIgnoreCase("warning")) { return Level.WARNING; } else if (lvl.equalsIgnoreCase("fine")) { return Level.FINE; } else if (lvl.equalsIgnoreCase("finer")) { return Level.FINER; } else if (lvl.equalsIgnoreCase("finest")) { return Level.FINEST; } else if (lvl.equalsIgnoreCase("all")) { return Level.ALL; } else if (lvl.equalsIgnoreCase("severe")) { return Level.SEVERE; } else if (lvl.equalsIgnoreCase("config")) { return Level.CONFIG; }//from ww w . j a v a 2 s .com return Level.INFO; }
From source file:jenkins.util.SystemProperties.java
/** * Gets the system property indicated by the specified key, or a default value. * This behaves just like {@link System#getProperty(java.lang.String, java.lang.String)}, except * that it also consults the {@link ServletContext}'s "init" parameters. * /*www.j a v a 2 s .co m*/ * @param key the name of the system property. * @param def a default value. * @return the string value of the system property, * or {@code null} if the property is missing and the default value is {@code null}. * * @exception NullPointerException if {@code key} is {@code null}. * @exception IllegalArgumentException if {@code key} is empty. */ public static String getString(String key, @CheckForNull String def) { return getString(key, def, Level.CONFIG); }
From source file:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java
@Override public boolean configEnabled() { return logger.isLoggable(Level.CONFIG); }
From source file:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java
@Override public void config(String msg, Throwable ex) { logger.logp(Level.CONFIG, "", "", msg, ex); }
From source file:alma.acs.logging.adapters.JacORBFilter.java
/** * Discards less useful or misleading Jacorb logs based on the message. * <p>//from ww w . ja v a2s .co m * TODO-: to improve performance, we could instead match file and line, but then would have to update * that information with the next jacorb code change. * The implementation already minimizes string comparison by checking only those messages that can occur at the given log level. * <p> * TODO: Add repeat guard based on the message, e.g. using MultipleRepeatGuard from jacsutil. */ public boolean isLoggable(LogRecord record) { String message = record.getMessage(); boolean isLoggable = true; if (record.getLevel().intValue() == Level.FINE.intValue()) { // map from FINE to FINEST if (message.startsWith("POA ") && (message.endsWith("shutdown is in progress") || message.endsWith("destruction is apparent") || message.endsWith("clear up the queue...") || message.endsWith("... done") || message.endsWith("stop the request controller") || message.endsWith("etherialize all servants ..."))) { record.setLevel(Level.FINEST); } else if (message.startsWith("get_policy_overrides returns") || message.startsWith("read GIOP message of size") || message.startsWith("wrote GIOP message of size")) { // From ACS unit tests it seems that this message is totally harmless, // caused by a Corba stub calling org.jacorb.orb.Delegate#getRelativeRoundtripTimeout() // and asking for the RELATIVE_RT_TIMEOUT_POLICY_TYPE policy. // We do not fully discard the log though because it may have other causes at the AOS. record.setLevel(Level.FINEST); // // Enable the following 2 lines to investigate for http://jira.alma.cl/browse/COMP-8302, to see where all these logs come from // String stackTrace = org.apache.commons.lang.exception.ExceptionUtils.getStackTrace(new Throwable()); // System.out.println("Hack for COMP-8302 debugging: 'get_policy_overrides returns' message logged with trace " + stackTrace); } // from FINE to discard else isLoggable = !(message.endsWith("_invoke: queuing request") || message.indexOf("is queued (queue size:") > 0 || message.endsWith("trying to get a RequestProcessor") || message.endsWith("waiting for queue") || message.endsWith("with request processing") || // for "starts...", "ends..." message.endsWith("invokeOperation on servant (stream based)") || message.endsWith("reset a previous completion call") || message.startsWith("Delegate.getReference") || message.startsWith("Received CodeSetContext. Using") || message.startsWith("ClientConnectionManager: releasing ClientGIOPConnection") || message.startsWith("Delegate released!") || message.endsWith(": streamClosed()") // findPOA: impl_name mismatch ); } else if (record.getLevel().intValue() == Level.INFO.intValue()) { // from INFO to CONFIG if (message.indexOf("(C) The JacORB project") > 0 || message.startsWith("Received CloseConnection on ClientGIOPConnection") || message.startsWith("prepare ORB for shutdown") || message.startsWith("Client-side TCP transport to") || message.startsWith("ORB going down...") || message.startsWith("ORB run") || // also "ORB run, exit" message.equals("ORB shutdown complete") || (message.startsWith("POA ") && (message.endsWith("destroyed"))) || message.startsWith("Opened new server-side TCP/IP")) { record.setLevel(Level.CONFIG); } // from INFO to FINEST else if (message.startsWith("Connected to ") || message.startsWith("Closed server-side transport to") || (message.startsWith("POA ") && (message.endsWith("up the queue ...") || message.endsWith("... done"))) || message.startsWith("Retrying to connect to") || message.startsWith("ClientConnectionManager: created new ClientGIOPConnection") || message.startsWith("ClientConnectionManager: found ClientGIOPConnection") || message.startsWith("Initialising ORB with ID") || message.startsWith("Set default native char codeset to") || message.startsWith("Set default native wchar codeset to") || message.equals("Listener exiting") || message.equals("ConsumerTie exited")) { record.setLevel(Level.FINEST); } // from INFO to stdout shortcut else if ((message.startsWith("ClientGIOPConnection to ") || message.startsWith("ServerGIOPConnection to ")) && message.contains(" BufferDump:\n") || message.startsWith("sendMessages(): ")) { // The jacorb dumps from org.jacorb.orb.etf.StreamConnectionBase.flush() // and org.jacorb.orb.giop.GIOPConnection.getMessage() are very special. // They get enabled via properties 'jacorb.debug.dump_outgoing_messages' // and 'jacorb.debug.dump_incoming_messages' and logged as INFO. // If they are enabled, we still want to see them only in the local logs // (otherwise there may be even "positive feedback" leading to log explosion). // A cleaner concept would be to only flag this LogRecord as "log only locally", // return "isLoggable = true" and leave the rest to the local and remote log handlers. // The fact that we are dealing with a generic LogRecord (not AcsLogRecord) makes this // option also ugly though (LogParameterUtil tricks), and thus we just print and drop // the log right away here. String timeStamp = IsoDateFormat.formatDate(new Date(record.getMillis())); System.out.println(timeStamp + " " + message); isLoggable = false; } // from INFO to discard else isLoggable = !(message.startsWith("oid: ") || message.startsWith("InterceptorManager started with") || message.startsWith("Using server ID (")); } else if (record.getLevel().intValue() == Level.WARNING.intValue()) { // from WARNING to CONFIG // if (message.indexOf("") > 0) { // record.setLevel(Level.CONFIG); // } // // from WARNING to FINEST // else if (message.startsWith("")) { // record.setLevel(Level.FINEST); // } // from WARNING to discard // else isLoggable = !(message.startsWith("no adapter activator exists for") // client tries to find remote poa locally and then complains if not there... ); } else if (record.getLevel().intValue() == Level.SEVERE.intValue()) { // HSO 07-02-19: thought this adapter activator crap was logged as warning, but now it showed up in jcont test as ACS-level "Emergency", which is JDK-SEVERE isLoggable = !(message.startsWith("no adapter activator exists for") // client tries to find remote poa locally and then complains if not there... ); } // filter by possibly modified log level if (isLoggable && record.getLevel().intValue() < this.logLevel) { isLoggable = false; } // if (!isLoggable) { // System.out.println("dropping JacORB message " + message + " with Level " + record.getLevel().getName()); // } // Remove non-ascii chars from the log message, which seems to occur only in logs coming from jacorb, // see http://jira.alma.cl/browse/COMP-3243 // For simplicity we blank all non-ascii-7-printable chars except newline and tab, // at the low risk of erroneously blanking more sophisticated (Umlaut etc) chars that jacorb may send us. // If that turns out to be the case, and the encoding turns out as unicode, then see http://en.wikipedia.org/wiki/C0_and_C1_control_codes if (isLoggable && message != null) { String message2 = null; int mlen = message.length(); for (int i = 0; i < mlen; i++) { char ch = message.charAt(i); if ((ch < 32 || ch >= 127) && ch != '\n' && ch != '\t') { // got a bad char if (message2 == null) { // copy the leading good chars only if needed, to improve performance message2 = message.substring(0, i); } // blank the bad char message2 += '#'; } else if (message2 != null) { message2 += ch; } } if (message2 != null) { record.setMessage(message2); } } return isLoggable; }
From source file:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java
@Override public void config(Throwable ex) { logger.logp(Level.CONFIG, "", "", "", ex); }