当前位置: 首页>>代码示例>>Java>>正文


Java LogRecord.setParameters方法代码示例

本文整理汇总了Java中java.util.logging.LogRecord.setParameters方法的典型用法代码示例。如果您正苦于以下问题:Java LogRecord.setParameters方法的具体用法?Java LogRecord.setParameters怎么用?Java LogRecord.setParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.logging.LogRecord的用法示例。


在下文中一共展示了LogRecord.setParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInputStream

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public InputStream getInputStream() throws java.io.FileNotFoundException {
    if (fixIt == null) {
        if (ERR.isLoggable(Level.FINE)) {
            LogRecord rec = new LogRecord(Level.FINE, "MSG_CACHED_INPUT_STREAM");
            rec.setParameters(new Object[] { this });
            rec.setResourceBundle(NbBundle.getBundle(MIMESupport.class));
            ERR.log(rec);
        }
        InputStream is = fileObj.getInputStream();

        fixIt = new CachedInputStream(is, fileObj);
    }

    fixIt.cacheToStart();

    return fixIt;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:MIMESupport.java

示例2: setShowOnStartup

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void setShowOnStartup( boolean show ) {
    boolean oldVal = isShowOnStartup();
    if( oldVal == show ) {
        return;
    }
    prefs().putBoolean(PROP_SHOW_ON_STARTUP, show);
    if( null != propSupport )
        propSupport.firePropertyChange( PROP_SHOW_ON_STARTUP, oldVal, show );

    LogRecord rec = new LogRecord(Level.INFO, "USG_SHOW_START_PAGE"); //NOI18N
    rec.setParameters(new Object[] {show} );
    rec.setLoggerName(Constants.USAGE_LOGGER.getName());
    rec.setResourceBundle(NbBundle.getBundle(BundleSupport.BUNDLE_NAME));
    rec.setResourceBundleName(BundleSupport.BUNDLE_NAME);

    Constants.USAGE_LOGGER.log(rec);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:WelcomeOptions.java

示例3: testLoggingMessageWithBundle

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void testLoggingMessageWithBundle() throws Exception {
    FileObject dir  = TimesCollectorPeerTest.makeScratchDir(this);
    
    Logger LOG = Logger.getLogger("TIMER.instance.of.my.object");
    LogRecord rec = new LogRecord(Level.FINE, "LOG_Project"); // NOI18N
    rec.setParameters(new Object[] { dir, dir });
    rec.setResourceBundle(ResourceBundle.getBundle(HandlerTest.class.getName()));
    LOG.log(rec);

    Collection<Object> files = TimesCollectorPeer.getDefault().getFiles();
    assertEquals("One object " + files, 1, files.size());
    
    Description descr = TimesCollectorPeer.getDefault().getDescription(files.iterator().next(), "LOG_Project");
    assertNotNull(descr);
    
    if (descr.getMessage().indexOf("My Project") == -1) {
        fail("Localized msg should contain 'My Project': " + descr.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:HandlerTest.java

示例4: createData

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private void createData(final File file2Create) throws IOException {
    boolean isSupported = new FileInfo(file2Create).isSupportedFile();                        
    ProvidedExtensions extensions =  getProvidedExtensions();
    
    if (!isSupported) {             
        extensions.createFailure(this, file2Create.getName(), false);
        FSException.io("EXC_CannotCreateData", file2Create.getName(), getPath());// NOI18N
    } else if (FileChangedManager.getInstance().exists(file2Create)) {
        extensions.createFailure(this, file2Create.getName(), false);
        SyncFailedException sfe = new SyncFailedException(file2Create.getAbsolutePath()); // NOI18N               
        String msg = NbBundle.getMessage(FileBasedFileSystem.class, "EXC_CannotCreateData", file2Create.getName(), getPath()); // NOI18N
        Exceptions.attachLocalizedMessage(sfe, msg);
        throw sfe;
    } else if (!file2Create.createNewFile()) {
        extensions.createFailure(this, file2Create.getName(), false);            
        FSException.io("EXC_CannotCreateData", file2Create.getName(), getPath());// NOI18N
    }        
    LogRecord r = new LogRecord(Level.FINEST, "DataCreated: "+ file2Create.getAbsolutePath());
    r.setParameters(new Object[] {file2Create});
    Logger.getLogger("org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj").log(r);        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:FolderObj.java

示例5: addHeapDump

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private static void addHeapDump(LogRecord record) {
    File heapDump = Installer.getHeapDump();
    if (heapDump != null) {
        String heapDumpPath = heapDump.getAbsolutePath();
        Object[] parameters = record.getParameters();
        if (parameters == null) {
            parameters = new Object[] { heapDumpPath };
        } else {
            Object[] newParams = new Object[parameters.length + 1];
            System.arraycopy(parameters, 0, newParams, 0, parameters.length);
            newParams[parameters.length] = heapDumpPath;
            parameters = newParams;
        }
        record.setParameters(parameters);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:AfterRestartExceptions.java

示例6: logThrowing

import java.util.logging.LogRecord; //导入方法依赖的package包/类
/**
 * Logs throwing of exceptions.
 * 
 * @param loggerName
 * @param thrown
 */
public static void logThrowing(String loggerName, Throwable thrown) {
	if (loggerName != null) {
		Logger logger = loggers.get(loggerName);
		if (logger != null) {
			Thread current = Thread.currentThread();
			int totalStackOffset = 2;
			StackTraceElement[] trace = current.getStackTrace();

			LogRecord logRecord = new LogRecord(Level.ALL, "Exception thrown!");

			if (trace.length >= totalStackOffset) {
				StackTraceElement caller = trace[totalStackOffset];
				logRecord.setSourceMethodName(caller.getMethodName());
				logRecord.setSourceClassName(caller.getClassName());
				int lineNumber = caller.getLineNumber();
				logRecord.setParameters(new Object[] { lineNumber });
				logRecord.setThrown(thrown);
			}
			logger.log(logRecord);
		}
	}
}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:29,代码来源:Logging.java

示例7: createFolder

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private void createFolder(final File folder2Create, final String name) throws IOException {
    boolean isSupported = new FileInfo(folder2Create).isSupportedFile();
    ProvidedExtensions extensions =  getProvidedExtensions();

    if (!isSupported) { 
        extensions.createFailure(this, folder2Create.getName(), true);
        FSException.io("EXC_CannotCreateFolder", folder2Create.getName(), getPath());// NOI18N   
    } else if (FileChangedManager.getInstance().exists(folder2Create)) {
        extensions.createFailure(this, folder2Create.getName(), true);            
        SyncFailedException sfe = new SyncFailedException(folder2Create.getAbsolutePath()); // NOI18N               
        String msg = NbBundle.getMessage(FileBasedFileSystem.class, "EXC_CannotCreateFolder", folder2Create.getName(), getPath()); // NOI18N
        Exceptions.attachLocalizedMessage(sfe, msg);
        throw sfe;
    } else if (!folder2Create.mkdirs()) {
        extensions.createFailure(this, folder2Create.getName(), true);
        FSException.io("EXC_CannotCreateFolder", folder2Create.getName(), getPath());// NOI18N               
    }
    LogRecord r = new LogRecord(Level.FINEST, "FolderCreated: "+ folder2Create.getAbsolutePath());
    r.setParameters(new Object[] {folder2Create});
    Logger.getLogger("org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj").log(r);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:FolderObj.java

示例8: setCurrentProfile

import java.util.logging.LogRecord; //导入方法依赖的package包/类
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,代码行数:23,代码来源:KeymapModel.java

示例9: logVCSActionEvent

import java.util.logging.LogRecord; //导入方法依赖的package包/类
/**
 * Logs a vcs client action usage.
 *
 * @param vcs - the particular vcs "SVN", "CVS", "CC", "HG", ...
 */
public static void logVCSActionEvent(String vcs) {
    String key = "USG_VCS_ACTION"  + vcs;
    if (checkMetricsKey(key)) return;
    LogRecord rec = new LogRecord(Level.INFO, "USG_VCS_ACTION");
    rec.setParameters(new Object[] { vcs });
    rec.setLoggerName(METRICS_LOG.getName());
    METRICS_LOG.log(rec);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:Utils.java

示例10: logUsage

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private static void logUsage(String startType, List<Object> params) {
    LogRecord record = new LogRecord(Level.INFO, "USG_PROFILER_" + startType); // NOI18N
    record.setResourceBundle(NbBundle.getBundle(GestureSubmitter.class));
    record.setResourceBundleName(GestureSubmitter.class.getPackage().getName() + ".Bundle"); // NOI18N
    record.setLoggerName(USG_LOGGER.getName());
    record.setParameters(params.toArray(new Object[0]));

    USG_LOGGER.log(record);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:GestureSubmitter.java

示例11: run

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void run()
  {
LogRecord record = new LogRecord(Level.INFO, "AUDIT:" + _message);
record.setLoggerName("audit");
record.setParameters(new Object[]{_actor, _punishment});
_logAudit.log(record);

      GmListTable.broadcastMessageToGMs(_message);

      switch(_punishment)
      {
          case PUNISH_BROADCAST:
              return;
          case PUNISH_KICK:
              _actor.closeNetConnection();
              break;
          case PUNISH_KICKBAN:
              _actor.setAccessLevel(-100);
              _actor.setAccountAccesslevel(-100);
          	_actor.closeNetConnection();
              break;
          case PUNISH_JAIL:
          	_actor.setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.DEFAULT_PUNISH_PARAM);
              break;
          case PUNISH_CHATBAN:
          	_actor.setChatBanned(true);
          	break;
      }
  }
 
开发者ID:L2jBrasil,项目名称:L2jBrasil,代码行数:30,代码来源:IllegalPlayerAction.java

示例12: doLog

import java.util.logging.LogRecord; //导入方法依赖的package包/类
protected void doLog( Level level, String key, Object[] params, Class wrapperClass,
    Throwable thr )
{
    LogRecord lrec = new LogRecord( level, key ) ;
    if (params != null)
        lrec.setParameters( params ) ;
    inferCaller( wrapperClass, lrec ) ;
    lrec.setThrown( thr ) ;
    lrec.setLoggerName( loggerName );
    lrec.setResourceBundle( logger.getResourceBundle() ) ;
    logger.log( lrec ) ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:LogWrapperBase.java

示例13: logRepositoryUsage

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public static void logRepositoryUsage(String connectorID, String repositoryUrl) {
    if (connectorID == null || repositoryUrl == null) {
        return;
    }        
    String bugtrackingType = getBugtrackingType(connectorID);
    String knownRepositoryFor = LogUtils.getKnownRepositoryFor(repositoryUrl);        
    if (!checkMetricsKey(getParamString(USG_ISSUE_TRACKING_REPOSITORY, bugtrackingType, knownRepositoryFor))) {
        LogRecord rec = new LogRecord(Level.INFO, USG_ISSUE_TRACKING_REPOSITORY);
        rec.setParameters(new Object[] { getBugtrackingType(connectorID), knownRepositoryFor});
        rec.setLoggerName(METRICS_LOG.getName());
        METRICS_LOG.log(rec);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:LogUtils.java

示例14: logUsage

import java.util.logging.LogRecord; //导入方法依赖的package包/类
/**
 * Logs feature usage.
 *
 * @param srcClass source class
 * @param message message key
 * @param params message parameters, may be <code>null</code>
 */
public static void logUsage(Class srcClass, String message, Object[] params) {
    Parameters.notNull("message", message);

    LogRecord logRecord = new LogRecord(Level.INFO, message);
    logRecord.setLoggerName(USG_LOGGER.getName());
    logRecord.setResourceBundle(NbBundle.getBundle(srcClass));
    logRecord.setResourceBundleName(srcClass.getPackage().getName() + ".Bundle"); // NOI18N
    if (params != null) {
        logRecord.setParameters(params);
    }
    USG_LOGGER.log(logRecord);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PersistenceUtils.java

示例15: generate

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public static void generate() {
    try {
        LogRecord record = new LogRecord(Level.INFO, "Java Version: {0}");
        record.setLoggerName("test");
        record.setParameters(new Object[] {System.getProperty("java.version")});
        System.out.println(generate(record));
    } catch (IOException | ClassNotFoundException x) {
        throw new RuntimeException(x);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:SerializeLogRecord.java


注:本文中的java.util.logging.LogRecord.setParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。