當前位置: 首頁>>代碼示例>>Java>>正文


Java Level.CONFIG屬性代碼示例

本文整理匯總了Java中java.util.logging.Level.CONFIG屬性的典型用法代碼示例。如果您正苦於以下問題:Java Level.CONFIG屬性的具體用法?Java Level.CONFIG怎麽用?Java Level.CONFIG使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.util.logging.Level的用法示例。


在下文中一共展示了Level.CONFIG屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: logNetBeansAPIUsage

/** Sends info to UI handler about NetBeans APIs in use
 */
private static void logNetBeansAPIUsage(String msg, Collection<ModuleDependency> deps) {
    List<String> cnbs = new ArrayList<String>();
    for (ModuleDependency moduleDependency : deps) {
        String cnb = moduleDependency.getModuleEntry().getCodeNameBase();
        // observe just NetBeans API module usage
        if (cnb.startsWith("org.openide") || cnb.startsWith("org.netbeans")) { // NOI18N
            cnbs.add(cnb);
        }
    }

    if (cnbs.isEmpty()) {
        return;
    }

    LogRecord rec = new LogRecord(Level.CONFIG, msg);
    rec.setParameters(cnbs.toArray(new String[0]));
    rec.setResourceBundleName(SingleModuleProperties.class.getPackage().getName() + ".Bundle"); // NOI18N
    rec.setResourceBundle(NbBundle.getBundle(SingleModuleProperties.class));
    rec.setLoggerName(UI_LOG.getName());
    UI_LOG.log(rec);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:SingleModuleProperties.java

示例2: setCurrentProfile

public void setCurrentProfile (String profileName) {
    String prev = getCurrentProfile();
    if (!prev.equals(profileName)) {
        LogRecord rec = new LogRecord(Level.CONFIG, "KEYMAP_SET_PROFILE"); // NOI18N
        rec.setParameters(new Object[]{ profileName, prev });
        rec.setResourceBundle(NbBundle.getBundle(KeymapModel.class));
        rec.setResourceBundleName(KeymapModel.class.getPackage().getName() + ".Bundle");
        rec.setLoggerName(UI_LOG.getName());
        UI_LOG.log(rec);
    }
    
    final String profile = displayNameToName(profileName);
    
    waitFinished(new Runnable() {
        public void run() {
            for (KeymapManager m : getKeymapManagerInstances()) {
                m.setCurrentProfile(profile);
            }
            profileData = null;
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:KeymapModel.java

示例3: publish

@Override
public void publish(LogRecord record) {
    Logger logger = getLogger(record.getLoggerName());
    Throwable exception = record.getThrown();
    Level level = record.getLevel();
    String message = getFormatter().formatMessage(record);

    if (level == Level.SEVERE) {
        logger.error(message, exception);
    } else if (level == Level.WARNING) {
        logger.warn(message, exception);
    } else if (level == Level.INFO) {
        logger.info(message, exception);
    } else if (level == Level.CONFIG) {
        logger.debug(message, exception);
    } else {
        logger.trace(message, exception);
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:19,代碼來源:ForwardLogHandler.java

示例4: randomLevel

private static Level randomLevel(Random r) {
    int lev = r.nextInt(1100);
    if (lev >= Level.SEVERE.intValue()) return Level.SEVERE;
    if (lev >= Level.WARNING.intValue()) return Level.WARNING;
    if (lev >= Level.INFO.intValue()) return Level.INFO;
    if (lev >= Level.CONFIG.intValue()) return Level.CONFIG;
    if (lev >= Level.FINE.intValue()) return Level.FINE;
    if (lev >= Level.FINER.intValue()) return Level.FINER;
    if (lev >= Level.FINEST.intValue()) return Level.FINEST;
    return Level.OFF;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:LogRecordsTest.java

示例5: createRecord

private static LogRecord[] createRecord(String msg, Project[] projects) {
    if (projects.length == 0) {
        return null;
    }
    
    Map<String,int[]> counts = new HashMap<String,int[]>();
    for (Project p : projects) {
        String n = p.getClass().getName();
        int[] cnt = counts.get(n);
        if (cnt == null) {
            cnt = new int[1];
            counts.put(n, cnt);
        }
        cnt[0]++;
    }
    
    Logger logger = Logger.getLogger("org.netbeans.ui.projects"); // NOI18N
    LogRecord[] arr = new LogRecord[counts.size()];
    int i = 0;
    for (Map.Entry<String,int[]> entry : counts.entrySet()) {
        LogRecord rec = new LogRecord(Level.CONFIG, msg);
        rec.setParameters(new Object[] { entry.getKey(), afterLastDot(entry.getKey()), entry.getValue()[0] });
        rec.setLoggerName(logger.getName());
        rec.setResourceBundle(NbBundle.getBundle(OpenProjectList.class));
        rec.setResourceBundleName(OpenProjectList.class.getPackage().getName()+".Bundle");
        
        arr[i++] = rec;
    }
    
    return arr;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:OpenProjectList.java

示例6: logBuildInfoRec

static LogRecord logBuildInfoRec(){
    LogRecord rec = new LogRecord(Level.CONFIG, BUILD_INFO_FILE);
    List<String> buildInfo = logBuildInfo();
    if (buildInfo != null){
        rec.setParameters(buildInfo.toArray());
    }
    return rec;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:BuildInfo.java

示例7: logFailure

static LogRecord logFailure() {
    LogRecord lr = new LogRecord(Level.CONFIG,TimeToFailure.class.getName() + ":" + totalTime);
    totalTime = 0;
    lastAction = 0;
    if(Installer.preferencesWritable) {
        prefs.putLong(MTTF,totalTime);
    }
    return lr;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:TimeToFailure.java

示例8: publish

@Override
public void publish(LogRecord record)
{
	String message = record.getMessage();
	Throwable exception = record.getThrown();
	Level level = record.getLevel();

	org.apache.log4j.Logger log4j = org.apache.log4j.Logger.getLogger("TomcatLog");

	// if tomcat log is not configured
	if( log4j == null )
	{
		return;
	}

	if( level == Level.SEVERE )
	{
		log4j.error(message, exception);
	}
	else if( level == Level.WARNING )
	{
		log4j.warn(message, exception);
	}
	else if( level == Level.INFO )
	{
		log4j.info(message, exception);
	}
	else if( level == Level.CONFIG )
	{
		log4j.debug(message, exception);
	}
	else
	{
		log4j.trace(message, exception);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:36,代碼來源:TomcatLogRedirector.java

示例9: write

private void write(final Level level, final String message, final String jobName, final Object... args) {
    for (int i = 0; i < args.length; i++) {
        if (args[i] instanceof SQSTriggerQueue) {
            args[i] = ((SQSTriggerQueue) args[i]).getUrl();
        }
        else if (args[i] instanceof Throwable) {
            args[i] = ExceptionUtils.getStackTrace((Throwable)args[i]);
        }
    }

    StringBuilder source = new StringBuilder();
    if (this.autoFormat) {
        final String id = String.format("%06X", Thread.currentThread().getId());
        source
            .append("[").append(ClassUtils.getAbbreviatedName(this.clazz, 1)).append("]")
            .append("[thread-").append(id).append("]");
        if (StringUtils.isNotBlank(jobName)) {
            source.append("[job-").append(jobName).append("]");
        }
    }

    String msg = String.format(message, args);
    if (level == Level.CONFIG) {
        msg = "[DEBUG] " + msg;
    } else if (level == Level.SEVERE) {
        msg = "[ERROR] " + msg;
    }

    this.logger.logp(level, source.toString(), "", msg);
    if (this.streamHandler != null) {
        this.streamHandler.flush();
    }
}
 
開發者ID:riboseinc,項目名稱:aws-codecommit-trigger-plugin,代碼行數:33,代碼來源:Log.java

示例10: getLogRec

public LogRecord getLogRec(){
    LogRecord rec = new LogRecord(Level.CONFIG, SLOWNESS_DATA);
    rec.setParameters(new Object[]{new Long(time), latestActionName, slownessType});
    return rec;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:SlownessData.java

示例11: getLogLevel

protected Level getLogLevel() {
	if (log.getLevel() == Level.ALL) return Level.FINEST;
	if (log.getLevel() == Level.OFF) return Level.WARNING;
	if (log.getLevel() == Level.CONFIG) return Level.WARNING;
	return log.getLevel();
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:6,代碼來源:BaseTest.java


注:本文中的java.util.logging.Level.CONFIG屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。