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


Java LogRecord.getResourceBundleName方法代碼示例

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


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

示例1: publish

import java.util.logging.LogRecord; //導入方法依賴的package包/類
@Override
public void publish(LogRecord record) {
    lastBundle = record.getResourceBundle();
    lastBundleName = record.getResourceBundleName();
    lastParams = record.getParameters();
    lastThrown = record.getThrown();
    lastMessage = record.getMessage();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:9,代碼來源:TestLogrbResourceBundle.java

示例2: publish

import java.util.logging.LogRecord; //導入方法依賴的package包/類
@Override
public synchronized void publish(LogRecord record) {
    Object[] params = record.getParameters();
    // Each GetRB thread has its own handler, but since they
    // log into the same logger, each handler may receive
    // messages emitted by other threads.
    // This means that GetRB#2.handler may receive a message
    // emitted by GetRB#1 at a time where the resource bundle
    // was still null.
    // To avoid falling into this trap, the GetRB thread passes
    // 'this' as argument to the messages it logs - which does
    // allow us here to ignore messages that where not emitted
    // by our own GetRB.this thread...
    if (params.length == 1) {
        if (params[0] == GetRB.this) {
            // The message was emitted by our thread.
            count++;
            rb = record.getResourceBundle();
            rbName = record.getResourceBundleName();
        } else {
            // The message was emitted by another thread: just
            // ignore it, as it may have been emitted at a time
            // where the resource bundle was still null, and
            // processing it may overwrite the 'rb' and 'rbName'
            // recorded from the message emitted by our own thread.
            if (VERBOSE) {
                System.out.println("Ignoring message logged by " + params[0]);
            }
            ignoreLogCount.incrementAndGet();
        }
    } else {
        ignoreLogCount.incrementAndGet();
        System.err.println("Unexpected message received");
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:36,代碼來源:TestLoggerBundleSync.java

示例3: publish

import java.util.logging.LogRecord; //導入方法依賴的package包/類
@Override
public void publish(LogRecord record) {
    lastBundle = record.getResourceBundle();
    lastBundleName = record.getResourceBundleName();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TestSetResourceBundle.java


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