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


Java LogRecord.setResourceBundle方法代码示例

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


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

示例1: testDirectlyLoggingAnExceptionWithALocalizedMessageAndTheRightLevelShowsItInADialog

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void testDirectlyLoggingAnExceptionWithALocalizedMessageAndTheRightLevelShowsItInADialog() throws Exception {
    NullPointerException npe = new NullPointerException("npe");

    LogRecord rec = new LogRecord(OwnLevel.UI, "MSG_KEY");
    rec.setThrown(npe);
    ResourceBundle b = ResourceBundle.getBundle("org/netbeans/core/NotifyExceptionBundle");
    rec.setResourceBundle(b);
    DD.toReturn = new HiddenDialog();
    Logger.global.log(rec);
    waitEQ();
    assertNotNull("We are going to display a warning", DD.lastDescriptor);
    assertTrue("We want message: " + DD.lastDescriptor, DD.lastDescriptor instanceof NotifyDescriptor.Message);
    NotifyDescriptor.Message msg = (NotifyDescriptor.Message)DD.lastDescriptor;
    assertEquals("Info msg", NotifyDescriptor.INFORMATION_MESSAGE, msg.getMessageType());
    assertEquals("Msg is localized", b.getString("MSG_KEY"), msg.getMessage());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NotifyExceptionTest.java

示例2: logNetBeansAPIUsage

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

示例3: testIconOfTheNode

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void testIconOfTheNode() throws Exception {
    LogRecord r = new LogRecord(Level.INFO, "icon_msg");
    r.setResourceBundleName("org.netbeans.lib.uihandler.TestBundle");
    r.setResourceBundle(ResourceBundle.getBundle("org.netbeans.lib.uihandler.TestBundle"));
    r.setParameters(new Object[] { new Integer(1), "Ahoj" });
    
    Node n = UINode.create(r);
    assertEquals("Name is taken from the message", "icon_msg", n.getName());
    
    if (!n.getDisplayName().matches(".*Ahoj.*")) {
        fail("wrong display name, shall contain Ahoj: " + n.getDisplayName());
    }
    
    Image img = n.getIcon(BeanInfo.ICON_COLOR_32x32);
    assertNotNull("Some icon", img);
    IconInfo imgReal = new IconInfo(img);
    IconInfo template = new IconInfo(getClass().getResource("testicon.png"));
    assertEquals("Icon from ICON_BASE used", template, imgReal);
    
    assertSerializedWell(r, n);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:DecorableTest.java

示例4: log

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private static void log(Connector c, Map<String, Argument> args) {
    LogRecord record = new LogRecord(Level.INFO, "USG_DEBUG_ATTACH_JPDA");
    record.setResourceBundle(NbBundle.getBundle(ConnectPanel.class));
    record.setResourceBundleName(ConnectPanel.class.getPackage().getName() + ".Bundle"); // NOI18N
    record.setLoggerName(USG_LOGGER.getName());
    List<Object> params = new ArrayList<Object>();
    params.add(c.name());
    StringBuilder arguments = new StringBuilder();
    for (Map.Entry argEntry : args.entrySet()) {
        //arguments.append(argEntry.getKey());
        //arguments.append("=");
        arguments.append(argEntry.getValue());
        arguments.append(", ");
    }
    if (arguments.length() > 2) {
        arguments.delete(arguments.length() - 2, arguments.length());
    }
    params.add(arguments);
    record.setParameters(params.toArray(new Object[params.size()]));
    USG_LOGGER.log(record);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ConnectPanel.java

示例5: testIconOfTheNode

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void testIconOfTheNode() throws Exception {
    LogRecord r = new LogRecord(Level.INFO, "icon_msg");
    r.setResourceBundleName("org.netbeans.modules.uihandler.TestBundle");
    r.setResourceBundle(ResourceBundle.getBundle("org.netbeans.modules.uihandler.TestBundle"));
    r.setParameters(new Object[] { new Integer(1), "Ahoj" });
    
    Node n = UINode.create(r);
    assertEquals("Name is taken from the message", "icon_msg", n.getName());
    
    if (!n.getDisplayName().matches(".*Ahoj.*")) {
        fail("wrong display name, shall contain Ahoj: " + n.getDisplayName());
    }
    
    Image img = n.getIcon(BeanInfo.ICON_COLOR_32x32);
    assertNotNull("Some icon", img);
    IconInfo imgReal = new IconInfo(img);
    IconInfo template = new IconInfo(getClass().getResource("testicon.png"));
    assertEquals("Icon from ICON_BASE used", template, imgReal);
    
    assertSerializedWell(n);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:UINodeTest.java

示例6: 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

示例7: assertAccess

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private LogRecord assertAccess(int index) {
    if (Children.MUTEX.isReadAccess()) {
        return null;
    }
    if (Children.MUTEX.isWriteAccess()) {
        return null;
    }
    if (!LOG.isLoggable(Level.FINE)) {
        return null;
    }
    Level level = LOG.isLoggable(Level.FINEST) ? Level.FINEST : Level.FINE;
    LogRecord rec = new LogRecord(level, "LOG_NO_READ_ACCESS"); // NOI18N
    rec.setResourceBundle(NbBundle.getBundle(VisualizerNode.class));
    rec.setParameters(new Object[] { this, index });
    rec.setLoggerName(LOG.getName());
    if (level == Level.FINEST) {
        rec.setThrown(new AssertionError(rec.getMessage()));
    }
    return rec;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:VisualizerNode.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: reportIndexerStatistics

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private static void reportIndexerStatistics(
        final @NonNull Logger logger,
        final @NonNull Level level,
        final @NonNull Object[] data) {
    if (logger.isLoggable(level)) {
        final LogRecord r = new LogRecord(level, "INDEXING_FINISHED"); //NOI18N
        r.setParameters(data);
        r.setResourceBundle(NbBundle.getBundle(RepositoryUpdater.class));
        r.setResourceBundleName(RepositoryUpdater.class.getPackage().getName() + ".Bundle"); //NOI18N
        r.setLoggerName(logger.getName());
        logger.log(r);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:RepositoryUpdater.java

示例10: logUsage

import java.util.logging.LogRecord; //导入方法依赖的package包/类
protected void logUsage() {
    LogRecord rec = new LogRecord(Level.INFO, "USG_START_PAGE_LINK"); //NOI18N
    String id = usageTrackingId;
    if( null == id )
        id = getText();
    rec.setParameters(new Object[] {id} );
    rec.setLoggerName(Constants.USAGE_LOGGER.getName());
    rec.setResourceBundle(NbBundle.getBundle(BundleSupport.BUNDLE_NAME));
    rec.setResourceBundleName(BundleSupport.BUNDLE_NAME);

    Constants.USAGE_LOGGER.log(rec);
    System.err.println("usage: " + id);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:LinkButton.java

示例11: log

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private static void log(String type, List<Object> params) {
    LogRecord record = new LogRecord(Level.INFO, type);
    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[params.size()]));

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

示例12: logUsage

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public static void logUsage(Class srcClass, String message, Object ...params) {
    Parameters.notNull("message", message); // NOI18N

    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,代码行数:13,代码来源:Util.java

示例13: 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

示例14: doLog

import java.util.logging.LogRecord; //导入方法依赖的package包/类
private void doLog(LogRecord lr, String rbname) 
{
  lr.setLoggerName(_log.getName());
  if (rbname != null)
  {
    lr.setResourceBundleName(rbname);
    lr.setResourceBundle(findResourceBundle(rbname));
  }
  log(lr);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:11,代码来源:TrinidadLogger.java

示例15: logDebugStart

import java.util.logging.LogRecord; //导入方法依赖的package包/类
static void logDebugStart(Session s, List<DebuggerEngine> engines) {
    LogRecord record = new LogRecord(Level.INFO, "USG_DEBUG_SESSION_START"); // NOI18N
    record.setResourceBundle(NbBundle.getBundle(GestureSubmitter.class));
    record.setResourceBundleName(GestureSubmitter.class.getPackage().getName() + ".Bundle"); // NOI18N
    record.setLoggerName(USG_LOGGER.getName());
    List params = new ArrayList();
    params.add(s.getName());
    params.add(s.getLocationName());
    params.add(s.getCurrentLanguage());
    record.setParameters(params.toArray(new Object[params.size()]));
    USG_LOGGER.log(record);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:GestureSubmitter.java


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