当前位置: 首页>>代码示例>>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;未经允许,请勿转载。