本文整理汇总了Java中java.util.logging.LogRecord.setLoggerName方法的典型用法代码示例。如果您正苦于以下问题:Java LogRecord.setLoggerName方法的具体用法?Java LogRecord.setLoggerName怎么用?Java LogRecord.setLoggerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.logging.LogRecord
的用法示例。
在下文中一共展示了LogRecord.setLoggerName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: logLookAndFeelUsage
import java.util.logging.LogRecord; //导入方法依赖的package包/类
private static void logLookAndFeelUsage() {
if( lafLogged )
return;
lafLogged = true;
LookAndFeel laf = UIManager.getLookAndFeel();
Logger logger = Logger.getLogger( "org.netbeans.ui.metrics.laf" ); // NOI18N
LogRecord rec = new LogRecord( Level.INFO, "USG_LOOK_AND_FEEL" ); //NOI18N
String lafId = laf.getID();
if( laf.getDefaults().getBoolean( "nb.dark.theme" ) ) //NOI18N
{
lafId = "DARK " + lafId; //NOI18N
}
rec.setParameters( new Object[]{ lafId, laf.getName() } );
rec.setLoggerName( logger.getName() );
logger.log( rec );
}
示例3: 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);
}
示例4: createRecordMetrics
import java.util.logging.LogRecord; //导入方法依赖的package包/类
private static LogRecord[] createRecordMetrics (String msg, Project[] projects) {
if (projects.length == 0) {
return null;
}
Logger logger = Logger.getLogger("org.netbeans.ui.metrics.projects"); // NOI18N
LogRecord[] arr = new LogRecord[projects.length];
int i = 0;
for (Project p : projects) {
LogRecord rec = new LogRecord(Level.INFO, msg);
rec.setParameters(new Object[] { p.getClass().getName() });
rec.setLoggerName(logger.getName());
arr[i++] = rec;
}
return arr;
}
示例5: fireBindingChanged
import java.util.logging.LogRecord; //导入方法依赖的package包/类
public FormModelEvent fireBindingChanged(RADComponent metacomp,
String path,
String subProperty,
Object oldValue,
Object newValue)
{
FormModelEvent ev = new FormModelEvent(this, FormModelEvent.BINDING_PROPERTY_CHANGED);
ev.setComponentAndContainer(metacomp, null);
ev.setProperty(path, oldValue, newValue);
ev.setSubProperty(subProperty);
sendEvent(ev);
if (undoRedoRecording && oldValue != newValue) {
if (!bindingModifiedLogged) {
Logger logger = Logger.getLogger("org.netbeans.ui.metrics.form"); // NOI18N
LogRecord rec = new LogRecord(Level.INFO, "USG_FORM_BINDING_MODIFIED"); // NOI18N
rec.setLoggerName(logger.getName());
logger.log(rec);
bindingModifiedLogged = true;
}
addUndoableEdit(ev.getUndoableEdit());
}
return ev;
}
示例6: 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);
}
}
示例7: 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);
}
示例8: 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);
}
}
示例9: testGenerateEnoughLogsExit
import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void testGenerateEnoughLogsExit() throws Exception {
LogRecord r = new LogRecord(Level.INFO, "MSG_SOMETHING");
r.setLoggerName(Installer.UI_LOGGER_NAME + ".anything");
String utf8 =
"<html><head>" +
"</head>" +
"<body>" +
"<form action='http://anna.nbextras.org/analytics/upload.jsp' method='post'>" +
" <input name='submit' value='&Fill Survey' type='hidden'> </input>" +
"</form>" +
"</body></html>";
ByteArrayInputStream is = new ByteArrayInputStream(utf8.getBytes("utf-8"));
MemoryURL.registerURL("memory://start.html", is);
for (int i = 0; i < 1500; i++) {
Logger.getLogger(Installer.UI_LOGGER_NAME + ".anything").log(r);
}
assertEquals("full buffer", 1000, InstallerTest.getLogsSize());
assertNull("No dialogs so far", DD.d);
installer.doClose();
waitForGestures();
assertNull("No dialogs at close", DD.d);
Preferences prefs = NbPreferences.forModule(Installer.class);
prefs.putInt("count", UIHandler.MAX_LOGS );
installer.restored();
waitForGestures();
// assertNotNull("A dialog shown at begining", DD.d);
}
示例10: logBugtrackingEvents
import java.util.logging.LogRecord; //导入方法依赖的package包/类
/**
* Logs bugtracking events
*
* @param key - the events key
* @param parameters - the parameters for the given event
*/
private static void logBugtrackingEvents(String key, Object[] parameters) {
LogRecord rec = new LogRecord(Level.INFO, key);
rec.setParameters(parameters);
rec.setLoggerName(METRICS_LOG.getName());
METRICS_LOG.log(rec);
}
示例11: killPendingTasks
import java.util.logging.LogRecord; //导入方法依赖的package包/类
/** Ends penidng tasks. */
private static void killPendingTasks() {
// no way to kill actions
final LogRecord r = new LogRecord(Level.INFO, "KILL_PENDING_TASKS"); //NOI18N
r.setLoggerName(LOG.getName());
LOG.log(r);
for (InternalHandle h : Controller.getDefault().getModel().getHandles()) {
h.requestCancel();
}
killRunningExecutors();
// [PENDING] When it'll be added another types of tasks (locks etc.)
// kill them here.
}
示例12: doLog
import java.util.logging.LogRecord; //导入方法依赖的package包/类
private void doLog(LogRecord lr)
{
lr.setLoggerName(_log.getName());
String ebname = _log.getResourceBundleName();
if (ebname != null)
{
lr.setResourceBundleName(ebname);
lr.setResourceBundle(_log.getResourceBundle());
}
_log.log(lr);
}
示例13: 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);
}
示例14: getUserInstalledModules
import java.util.logging.LogRecord; //导入方法依赖的package包/类
static LogRecord getUserInstalledModules(Logger logger) {
LogRecord rec = new LogRecord(Level.INFO, "USG_USER_INSTALLED_MODULES");
Set<String> clusterNames = new HashSet<String>(getClusterNames());
clusterNames.add("platform"); // NOI18N
List<ModuleInfo> userInstalledModules = new ArrayList<ModuleInfo>();
for (ModuleInfo mi : Lookup.getDefault().lookupAll(ModuleInfo.class)) {
Object showAttr = mi.getAttribute("AutoUpdate-Show-In-Client"); // NOI18N
if (!(showAttr instanceof String) ||
!Boolean.parseBoolean((String) showAttr)) {
continue;
}
File moduleJarFile = getModuleJarFile(mi);
if (moduleJarFile == null) {
continue;
}
File moduleParent = moduleJarFile.getParentFile();
if (moduleParent.getName().equals("modules")) { // NOI18N
String cn = moduleParent.getParentFile().getName();
if (!clusterNames.contains(cn)) {
userInstalledModules.add(mi);
}
}
}
rec.setParameters(getModuleNames(userInstalledModules));
rec.setLoggerName(logger.getName());
return rec;
}
示例15: uilog
import java.util.logging.LogRecord; //导入方法依赖的package包/类
static void uilog(LogRecord rec) {
rec.setResourceBundle(NbBundle.getBundle(CompletionImpl.class));
rec.setResourceBundleName(CompletionImpl.class.getPackage().getName() + ".Bundle"); // NOI18N
rec.setLoggerName(UI_LOG.getName());
UI_LOG.log(rec);
}