Example usage for java.util.logging Level CONFIG

List of usage examples for java.util.logging Level CONFIG

Introduction

In this page you can find the example usage for java.util.logging Level CONFIG.

Prototype

Level CONFIG

To view the source code for java.util.logging Level CONFIG.

Click Source Link

Document

CONFIG is a message level for static configuration messages.

Usage

From source file:com.elasticbox.jenkins.k8s.cfg.PluginInitializer.java

private static PodSlaveConfig getDefaultPodSlaveConfig() {

    final InputStream yamlStream = PodSlaveConfig.class
            .getResourceAsStream("PodSlaveConfig/" + DEFAULT_JENKINS_SLAVE_POD_YAML);

    String yamlString;//from   w w w  .ja v  a  2s .c o  m
    try {
        yamlString = IOUtils.toString(yamlStream);
    } catch (IOException exception) {
        LOGGER.severe(NAME_PREFIX + exception);
        return null;
    }

    final String jenkinsServiceHost = System.getenv(JENKINS_SERVICE_HOST);
    final String jenkinsServicePort = System.getenv(JENKINS_SERVICE_PORT);

    if (jenkinsServiceHost != null && jenkinsServicePort != null) {
        yamlString = yamlString.replace("${JENKINS_URL}",
                "http://" + jenkinsServiceHost + ':' + jenkinsServicePort);
    }

    if (LOGGER.isLoggable(Level.CONFIG)) {
        LOGGER.config("Default Pod Yaml definition: " + yamlString);
    }

    final PodSlaveConfig podSlaveConfig = new PodSlaveConfig(DEFAULT_JENKINS_SLAVE_POD_YAML,
            "Default JenkinsSlave Pod", yamlString, null);

    return podSlaveConfig;
}

From source file:org.mili.core.logging.java.JavaAdapterTest.java

@Test
public void shouldGetInfoLevelForConfig() {
    log.setLevel(Level.CONFIG);
    assertEquals(org.mili.core.logging.Level.INFO, logger.getLevel());
}

From source file:org.jomc.logging.ri.commons.CommonsLogger.java

public void onLog(final Level level, final String message, final Throwable throwable) {
    if (level != null) {
        if (level.equals(Level.CONFIG) || level.equals(Level.FINE)) {
            this.getObjectManagementLogger().debug(message, throwable);
        } else if (level.equals(Level.FINER) || level.equals(Level.FINEST)) {
            this.getObjectManagementLogger().trace(message, throwable);
        } else if (level.equals(Level.INFO)) {
            this.getObjectManagementLogger().info(message, throwable);
        } else if (level.equals(Level.SEVERE)) {
            this.getObjectManagementLogger().error(message, throwable);
        } else if (level.equals(Level.WARNING)) {
            this.getObjectManagementLogger().warn(message, throwable);
        } else {/*from  w  w  w  .  jav  a 2 s  . c  o m*/
            this.getObjectManagementLogger().trace(message, throwable);
        }
    }
}

From source file:org.jamwiki.utils.WikiLogger.java

/**
 * Log a message and an exception at the {@link java.util.logging.Level#CONFIG}
 * level, provided that the current log level is {@link java.util.logging.Level#CONFIG}
 * or greater.//from   w w  w .  j  av a 2  s.  co m
 *
 * @param msg The message to be written to the log.
 * @param thrown An exception to be written to the log.
 */
public void config(String msg, Throwable thrown) {
    this.logger.log(Level.CONFIG, msg, thrown);
}

From source file:com.massabot.codesender.GrblController.java

/***********************
 * API Implementation. */* w  w  w.j a v a  2  s.  co m*/
 ***********************/

@Override
protected void rawResponseHandler(String response) {
    if (GcodeCommand.isOkErrorResponse(response)) {
        String processed = response;
        if (response.startsWith("error:")) {
            String parts[] = response.split(":");
            if (parts.length == 2) {
                String code = parts[1].trim();
                if (StringUtils.isNumeric(code)) {
                    String[] errorParts = ERRORS.lookup(code);
                    if (errorParts != null && errorParts.length >= 3) {
                        processed = "error: " + errorParts[1] + ": " + errorParts[2];
                    }
                }
            }
        }
        try {
            this.commandComplete(processed);
            this.messageForConsole(processed + "\n");
        } catch (Exception e) {
            String message = "";
            if (e.getMessage() != null) {
                message = ": " + e.getMessage();
            }
            this.errorMessageForConsole(
                    Localization.getString("controller.error.response") + " <" + processed + ">" + message);
        }
    }

    else if (GrblUtils.isGrblVersionString(response)) {
        this.stopPollingPosition();
        positionPollTimer = createPositionPollTimer();
        this.beginPollingPosition();

        this.isReady = true;
        resetBuffers();

        // In case a reset occurred while streaming.
        if (this.isStreaming()) {
            checkStreamFinished();
        }

        // Version string goes to console
        this.messageForConsole(response + "\n");

        this.grblVersion = GrblUtils.getVersionDouble(response);
        this.grblVersionLetter = GrblUtils.getVersionLetter(response);

        this.capabilities = GrblUtils.getGrblStatusCapabilities(this.grblVersion, this.grblVersionLetter);
        try {
            this.sendCommandImmediately(createCommand(GrblUtils.GRBL_VIEW_SETTINGS_COMMAND));
            this.sendCommandImmediately(createCommand(GrblUtils.GRBL_VIEW_PARSER_STATE_COMMAND));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        this.beginPollingPosition();

        Logger.getLogger(GrblController.class.getName()).log(Level.CONFIG, "{0} = {1}{2}", new Object[] {
                Localization.getString("controller.log.version"), this.grblVersion, this.grblVersionLetter });
        Logger.getLogger(GrblController.class.getName()).log(Level.CONFIG, "{0} = {1}", new Object[] {
                Localization.getString("controller.log.realtime"), this.capabilities.REAL_TIME });
    }

    else if (GrblUtils.isGrblStatusString(response)) {
        // Only 1 poll is sent at a time so don't decrement, reset to zero.
        this.outstandingPolls = 0;

        // Status string goes to verbose console
        verboseMessageForConsole(response + "\n");

        this.handleStatusString(response);
    }

    else if (GrblUtils.isGrblFeedbackMessage(response, capabilities)) {
        GrblFeedbackMessage grblFeedbackMessage = new GrblFeedbackMessage(response);
        this.verboseMessageForConsole(grblFeedbackMessage.toString() + "\n");
        this.messageForConsole(response + "\n");
        setDistanceModeCode(grblFeedbackMessage.getDistanceMode());
        setUnitsCode(grblFeedbackMessage.getUnits());
    }

    else if (GrblUtils.isGrblSettingMessage(response)) {
        GrblSettingMessage message = new GrblSettingMessage(response);
        this.messageForConsole(message + "\n");
        if (message.isReportingUnits()) {
            setReportingUnits(message.getReportingUnits());
        }
    }

    else {
        // Display any unhandled messages
        this.messageForConsole(response + "\n");
    }
}

From source file:com.google.enterprise.connector.sharepoint.wsclient.soap.SPSiteDataWS.java

/**
 * Gets the collection of all the lists on the sharepoint server which are of
 * a given type. E.g., DocumentLibrary//from ww  w. j  a va2  s. c o  m
 *
 * @param webstate The web from which the list/libraries are to be discovered
 * @return list of BaseList objects.
 */
public List<ListState> getNamedLists(final WebState webstate) throws SharepointException {
    final ArrayList<ListState> listCollection = new ArrayList<ListState>();
    if (stub == null) {
        LOGGER.warning("Unable to get the list collection because stub is null");
        return listCollection;
    }

    if (webstate == null) {
        LOGGER.warning("Unable to get the list collection because webstate is null");
        return listCollection;
    }

    final Collator collator = Util.getCollator();
    final ArrayOf_sListHolder vLists = new ArrayOf_sListHolder();
    final UnsignedIntHolder getListCollectionResult = new UnsignedIntHolder();

    try {
        stub.getListCollection(getListCollectionResult, vLists);
    } catch (final AxisFault af) { // Handling of username formats for
        // different authentication models.
        if ((SPConstants.UNAUTHORIZED.indexOf(af.getFaultString()) != -1)
                && (sharepointClientContext.getDomain() != null)) {
            final String username = Util.switchUserNameFormat(stub.getUsername());
            LOGGER.log(Level.CONFIG, "Web Service call failed for username [ " + stub.getUsername()
                    + " ]. Trying with " + username);
            stub.setUsername(username);
            try {
                stub.getListCollection(getListCollectionResult, vLists);
            } catch (final Exception e) {
                LOGGER.log(Level.WARNING, "Unable to get List Collection for stubURL[ "
                        + sharepointClientContext.getSiteURL() + " ].", e);
            }
        } else {
            LOGGER.log(Level.WARNING, "Unable to get List Collection for stubURL[ "
                    + sharepointClientContext.getSiteURL() + " ].", af);
        }
    } catch (final Throwable e) {
        LOGGER.log(Level.WARNING,
                "Unable to get List Collection for stubURL[ " + sharepointClientContext.getSiteURL() + " ].",
                e);
    }

    if (vLists == null) {
        LOGGER.log(Level.WARNING, "Unable to get the list collection");
        return listCollection;
    }

    try {
        final _sList[] sl = vLists.value;

        if (sl != null) {
            webstate.setExisting(true);
            for (_sList element : sl) {
                String url = null;
                String strBaseTemplate = null;

                if (element == null) {
                    continue;
                }

                final String baseType = element.getBaseType();
                LOGGER.log(Level.FINE, "Base Type returned by the Web Service : " + baseType);
                if (!collator.equals(baseType, (SPConstants.DISCUSSION_BOARD))
                        && !collator.equals(baseType, (SPConstants.DOC_LIB))
                        && !collator.equals(baseType, (SPConstants.GENERIC_LIST))
                        && !collator.equals(baseType, (SPConstants.ISSUE))
                        && !collator.equals(baseType, (SPConstants.SURVEYS))) {
                    continue;
                }

                url = Util.getWebApp(sharepointClientContext.getSiteURL()) + element.getDefaultViewUrl();

                strBaseTemplate = element.getBaseTemplate();
                if (strBaseTemplate == null) {
                    strBaseTemplate = SPConstants.NO_TEMPLATE;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_SLIDELIBRARY)) {// for
                    // SlideLibrary
                    strBaseTemplate = SPConstants.BT_SLIDELIBRARY;
                } else if (collator.equals(strBaseTemplate,
                        SPConstants.ORIGINAL_BT_TRANSLATIONMANAGEMENTLIBRARY)) {// for
                    // TranslationManagementLibrary
                    strBaseTemplate = SPConstants.BT_TRANSLATIONMANAGEMENTLIBRARY;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_TRANSLATOR)) {// for
                    // Translator
                    strBaseTemplate = SPConstants.BT_TRANSLATOR;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_REPORTLIBRARY)) {// for
                    // ReportLibrary
                    strBaseTemplate = SPConstants.BT_REPORTLIBRARY;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_PROJECTTASK)) {// for
                    // ReportLibrary
                    strBaseTemplate = SPConstants.BT_PROJECTTASK;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_SITESLIST)) {// for
                    // ReportLibrary
                    strBaseTemplate = SPConstants.BT_SITESLIST;
                } else {
                    // for FormLibrary
                    for (String formTemplate : sharepointClientContext.getInfoPathBaseTemplate()) {
                        if (collator.equals(strBaseTemplate, formTemplate)) {
                            strBaseTemplate = SPConstants.BT_FORMLIBRARY;
                            break;
                        }
                    }
                }

                LOGGER.config("List URL :" + url);

                // Children of all URLs are discovered
                ListState list = new ListState(element.getInternalName(), element.getTitle(),
                        element.getBaseType(), Util.siteDataStringToCalendar(element.getLastModified()),
                        strBaseTemplate, url, webstate);

                list.setInheritedSecurity(element.isInheritedSecurity());
                list.setApplyReadSecurity(element.getReadSecurity() == 2);

                String myNewListConst = "";
                final String listUrl = element.getDefaultViewUrl();// e.g.
                // /sites/abc/Lists/Announcements/AllItems.aspx
                LOGGER.log(Level.FINE, "getting listConst for list URL [ " + listUrl + " ] ");
                if ((listUrl != null) /* && (siteRelativeUrl!=null) */) {
                    final StringTokenizer strTokList = new StringTokenizer(listUrl, SPConstants.SLASH);
                    if (null != strTokList) {
                        while ((strTokList.hasMoreTokens()) && (strTokList.countTokens() > 1)) {
                            final String listToken = strTokList.nextToken();
                            if (list.isDocumentLibrary() && listToken.equals(SPConstants.FORMS_LIST_URL_SUFFIX)
                                    && (strTokList.countTokens() == 1)) {
                                break;
                            }
                            if (null != listToken) {
                                myNewListConst += listToken + SPConstants.SLASH;
                            }
                        }
                        list.setListConst(myNewListConst);
                        LOGGER.log(Level.CONFIG,
                                "using listConst [ " + myNewListConst + " ] for list URL [ " + listUrl + " ] ");

                        // Apply the URL filter here

                        // check if the entire list subtree is to excluded
                        // by comparing the prefix of the list URL with the
                        // patterns
                        if (sharepointClientContext
                                .isIncludedUrl(webstate.getWebUrl() + SPConstants.SLASH + myNewListConst)) {
                            // is included check if actual list url itself
                            // is to be excluded
                            if (sharepointClientContext.isIncludedUrl(url)) {
                                // if a List URL is included, it WILL be
                                // sent as a
                                // Document
                                list.setSendListAsDocument(true);
                            } else {
                                // if a List URL is EXCLUDED, it will NOT be
                                // sent as a
                                // Document
                                list.setSendListAsDocument(false);
                                LOGGER.warning("excluding " + url.toString());
                            }
                            // add the attribute(Metadata to the list )
                            list = getListWithAllAttributes(list, element);

                            listCollection.add(list);
                        } else {
                            // entire subtree is to be excluded
                            // do not construct list state
                            LOGGER.warning("Excluding " + url + " because entire subtree of " + myNewListConst
                                    + " is excluded");
                        }
                    }
                }

                // Sort the base list
                Collections.sort(listCollection);
                // dumpcollection(listCollection);
            }
        }
    } catch (final Throwable e) {
        LOGGER.log(Level.FINER, e.getMessage(), e);
        return listCollection;
    }

    if (listCollection.size() > 0) {
        LOGGER.info("Discovered " + listCollection.size() + " lists/libraries under site [ " + webstate
                + " ] for crawling");
    } else {
        LOGGER.config("No lists/libraries to crawl under site [ " + webstate + " ]");
    }
    return listCollection;
}

From source file:org.manalang.monkeygrease.MonkeygreaseFilter.java

/**
 * Initializes Monkeygrease. Internal servlet filter method.
 * /* w w  w. ja v  a2s.  co m*/
 * @param filterConfig
 * @throws ServletException
 */
public void init(FilterConfig filterConfig) throws ServletException {

    try {
        fh = new FileHandler("monkeygrease_%u.log");
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    // Send logger output to our FileHandler.
    log.addHandler(fh);
    log.getHandlers()[0].setFormatter(new LogFormatter());

    fc = filterConfig;
    confReloadCheckIntervalStr = fc.getInitParameter("confReloadCheckInterval");
    String commentsOnStr = fc.getInitParameter("commentsOn");
    COMMENTS_ON = commentsOnStr.toLowerCase().equals("true");
    String logLevel = fc.getInitParameter("logLevel");
    int logLevelInt;
    if (logLevel != null)
        logLevelInt = Integer.parseInt(logLevel);
    else
        logLevelInt = 0;
    remoteConfigURL = fc.getInitParameter("remoteConfigURL");
    if (remoteConfigURL != "" && remoteConfigURL != null)
        client = new HttpClient();

    switch (logLevelInt) {
    case SEVERE:
        log.setLevel(Level.SEVERE);
        break;
    case WARNING:
        log.setLevel(Level.WARNING);
        break;
    case INFO:
        log.setLevel(Level.INFO);
        break;
    case CONFIG:
        log.setLevel(Level.CONFIG);
        break;
    case FINE:
        log.setLevel(Level.FINE);
        break;
    case FINER:
        log.setLevel(Level.FINER);
        break;
    case FINEST:
        log.setLevel(Level.FINEST);
        break;
    default:
        log.setLevel(Level.SEVERE);
        break;
    }

    if (confReloadCheckIntervalStr != null && !"".equals(confReloadCheckIntervalStr)) {
        // convert to millis
        confReloadCheckInterval = 1000 * Integer.parseInt(confReloadCheckIntervalStr);
        confReloadCheckEnabled = true;
        if (confReloadCheckInterval == 0) {
            log.config("Reload check performed on each request");
        } else {
            log.config("Reload check set to " + confReloadCheckInterval / 1000 + "s");
        }
    } else {
        confReloadCheckEnabled = false;
    }

    sc = fc.getServletContext();
    cf = new Config(sc);
    rules = cf.getRules();

}

From source file:com.eurodyn.qlack2.util.datasource.generic.Configurator.java

public void refresh() {
    try {//from w  ww  .  ja  va2  s  .c o m
        Object registeredDs;

        // Configure the database driver.
        Object dbDriver = Class.forName(getDriverClass()).newInstance();
        // To configure the driver in a generic way, we use the
        // driverParametersMapping.
        String[] params = getDriverParametersMapping().split(",");
        for (String param : params) {
            param = param.trim();
            String paramKey = param.trim().split("-")[0];
            String paramValue = param.trim().split("-")[1];
            String property = BeanUtils.getProperty(this, paramValue);
            BeanUtils.setProperty(dbDriver, paramKey, property);
        }

        if (datasourceType.equals("javax.sql.XADataSource")) {
            BasicManagedDataSource managedDs = new BasicManagedDataSource();
            managedDs.setTransactionManager(transactionManager);
            managedDs.setXaDataSourceInstance((XADataSource) dbDriver);
            managedDs.setInitialSize(initialSize);
            managedDs.setMaxActive(maxActive);
            managedDs.setMaxIdle(maxIdle);
            managedDs.setMinIdle(minIdle);
            managedDs.setMaxWait(maxWait);
            managedDs.setValidationQuery(validationQuery);
            managedDs.setTestOnBorrow(testOnBorrow);
            managedDs.setRemoveAbandoned(removeAbandoned);
            managedDs.setRemoveAbandonedTimeout(removeAbandonedTimeout);
            registeredDs = managedDs;
        } else {
            registeredDs = dbDriver;
        }

        // If the service is already registered it should be unregistered first.
        for (ServiceRegistration<?> registration : serviceRegistrations) {
            registration.unregister();
        }

        // Expose datasources using the driver configured above.
        // This bundle accepts multiple jndi names as a comma-separated list so we
        // expose as many services as the provided jndi names.
        String[] jndiNames = jndiName.split(",");
        for (String name : jndiNames) {
            Dictionary<String, String> registrationProperties = new Hashtable<String, String>();
            registrationProperties.put("osgi.jndi.service.name", name);
            ServiceRegistration<?> registration = context.registerService(DataSource.class.getName(),
                    registeredDs, registrationProperties);
            serviceRegistrations.add(registration);
            LOGGER.log(Level.CONFIG, "Registered Datasource for {0} under {1}.",
                    new String[] { getDriverClass(), name });
        }
    } catch (ClassNotFoundException e) {
        LOGGER.log(Level.SEVERE, MessageFormat.format("Could not find database driver {0}.", getDriverClass()),
                e);
    } catch (InvocationTargetException | InstantiationException | IllegalAccessException
            | NoSuchMethodException e) {
        LOGGER.log(Level.SEVERE,
                MessageFormat.format("Could not instantiate database driver {0}.", getDriverClass()), e);
    }
}

From source file:org.mili.core.logging.java.JavaAdapterTest.java

@Test
public void shouldIsInfoEnabled() {
    log.setLevel(Level.INFO);
    assertTrue(logger.isInfoEnabled());
    log.setLevel(Level.CONFIG);
    assertTrue(logger.isInfoEnabled());
}

From source file:org.ow2.mind.unit.Launcher.java

protected void init(final String... args) throws InvalidCommandLineException {

    List<String> testFoldersList;

    if (logger.isLoggable(Level.CONFIG)) {
        for (final String arg : args) {
            logger.config("[arg] " + arg);
        }//from   w w w.j a va  2 s . co  m
    }

    /****** Initialization of the PluginManager Component *******/

    final Injector bootStrapPluginManagerInjector = getBootstrapInjector();
    final PluginManager pluginManager = bootStrapPluginManagerInjector.getInstance(PluginManager.class);

    addOptions(pluginManager);

    // parse arguments to a CommandLine.
    final CommandLine cmdLine = CommandLine.parseArgs(options, false, args);
    checkExclusiveGroups(pluginManager, cmdLine);
    compilerContext.put(CmdOptionBooleanEvaluator.CMD_LINE_CONTEXT_KEY, cmdLine);
    invokeOptionHandlers(pluginManager, cmdLine, compilerContext);

    // If help is asked, print it and exit.
    if (helpOpt.isPresent(cmdLine)) {
        printHelp(System.out);
        System.exit(0);
    }

    // If version is asked, print it and exit.
    if (versionOpt.isPresent(cmdLine)) {
        printVersion(System.out);
        System.exit(0);
    }

    // If the extension points list is asked, print it and exit.
    if (extensionPointsListOpt.isPresent(cmdLine)) {
        printExtensionPoints(pluginManager, System.out);
        System.exit(0);
    }

    // get the test folders list
    testFoldersList = cmdLine.getArguments();

    if (!testFoldersList.isEmpty()) {
        checkAndStoreValidTargetFolders(testFoldersList);
    } else {
        logger.severe("You must specify a target directory.");
        printHelp(System.out);
        System.exit(1);
    }

    // also add the URL of the generated files folder (for the mindUnitSuite.c file to be accessible)
    createAndAddGeneratedFilesFolderToPathURLs();

    // add the computed test folders to the src-path
    addTestFoldersToPath();

    // initialize compiler
    initInjector(pluginManager, compilerContext);

    initCompiler();

    /*
     *  We need to force regeneration (which leads to lose incremental compilation advantages... :( )
     *  In order for:
     *  - The Container not to be reloaded with already existing @TestSuite-s, leading to duplicates
     *  (we don't check for consistency yet)
     *  - The @TestSuites not to be reloaded with already added exported test interfaces (with their internal
     *  dual interface, membrane code with stubs when needed, and internal binding...)
     *  (as previously we want to avoid duplicates since we only ADD elements (no diff/remove), and our check
     *  for no outer interface on @TestSuite-s would fail)
     *  - The MindUnitSuiteDefinition has to be regenerated according to @TestSuite-s and @Test-s,
     *  as the C implementation and client interfaces may change according to what we find
     *  - The Container also has already been completed with according bindings at the previous compile time
     *  and we again do not check for consistency
     *  
     *  TODO: consider incremental compilation solutions ? What we only want to reload every time are 
     *  the components containing the user content and not the user files (only when there is change there...).
     *  How to discriminate such behavior ?
     */
    ForceRegenContextHelper.setForceRegen(compilerContext, true);

}