當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。