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


Java LogRecord.getMessage方法代码示例

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


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

示例1: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public synchronized void publish(LogRecord record) {
    final String message = record.getMessage();
    if (JFXApplicationClassChooser.LOG_INIT.equals(message)) {
        callInterceptor(0);
    } else if (JFXApplicationClassChooser.LOG_MAIN_CLASSES.equals(message)) {
        callInterceptor(1);
        final String[] result = ((Set<String>)record.getParameters()[0]).toArray(new String[0]);
        final boolean scan = (Boolean) record.getParameters()[1];
        final String[] expected = mainClasses.removeFirst();
        Arrays.sort(result);
        Arrays.sort(expected);
        final boolean last = mainClasses.isEmpty();
        if (last == scan) {
            failure = "Expected " + (!last) + ", Result: " + scan;  //NOI18N
            notifyAll();
        } else if (!Arrays.equals(expected, result)) {
            failure = "Expected " + Arrays.toString(expected) + ", Result: " + Arrays.toString(result); //NOI18N
            notifyAll();
        } else if (last) {
            notifyAll();
        }                
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:JFXApplicationClassChooserTest.java

示例2: testOwnFormatter

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void testOwnFormatter() throws UnsupportedEncodingException {
    class MyFrmtr extends Formatter {
        private int cnt;
        @Override
        public String format(LogRecord record) {
            cnt++;
            return record.getMessage();
        }
    }
    MyFrmtr my = new MyFrmtr();
    
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    StreamHandler sh = new StreamHandler(os, NbFormatter.FORMATTER);
    DispatchingHandler dh = new DispatchingHandler(sh, 10);
    dh.setFormatter(my);
    dh.publish(new LogRecord(Level.WARNING, "Ahoj"));
    dh.flush();
    String res = new String(os.toByteArray(), "UTF-8");
    assertEquals("Only the message is written", "Ahoj", res);
    assertEquals("Called once", 1, my.cnt);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:DispatchingHandlerTest.java

示例3: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
    String message = record.getMessage();
    if (message.startsWith("refreshAll: starting status scan for ") && (
            message.contains(workdirFO.getPath() + ",")
            || message.contains(workdirFO.getPath() + "]")
            || message.contains(modifiedFile.getParentFile().getParentFile().getAbsolutePath()))) {
        refreshStarted = true;
        refreshString = message;
    } else if (refreshStarted && message.startsWith("refreshAll: finishes status scan after ")) {
        refreshed = true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ExternalChangesTest.java

示例4: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
    final String msg = record.getMessage();
    if (msg != null) {
        final Action action = actions.get(msg);
        if (action != null) {
            try {
                action.run(record.getParameters());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:CancelSupportTest.java

示例5: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
    String msg = record.getMessage();
    String method = record.getSourceMethodName();
    String className = record.getSourceClassName();
    if (msg.contains(illegal)) {
        testFailed = true;
    }
    if (msg.contains("attribute names=")) {
        System.err.println("LOG: " + className + "." + method + ": " + msg);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TestLogHandler.java

示例6: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
    String msg = record.getMessage();
    assertFalse("Duplicate scan of project tree detected: " + msg,
            msg.startsWith("Warning: two modules found with the same code name base"));
    if (msg.startsWith("scanPossibleProject: ") && msg.endsWith("scanned successfully")
            && ! scannedDirs.add(msg)) {
        error = "scanPossibleProject already run: " + msg;
    }
    if (msg.startsWith("scanCluster: ") && msg.endsWith(" succeeded.")
            && ! scannedDirs.add(msg)) {
        error = "scanCluster already run: " + msg;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ModuleListTest.java

示例7: isLoggable

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public boolean isLoggable(LogRecord record) {
    String msg = record.getMessage();
    if (msg != null && msg.contains(targetMessage)) {
        messageCount.incrementAndGet();
    }

    return true;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:TestWebappClassLoaderThreadLocalMemoryLeak.java

示例8: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {            
    String msg = record.getMessage();
    if(msg == null || msg.trim().equals("")) {
        return;
    }
    if(msg.startsWith("refreshRecursively")) {
        methodNames.add("refreshRecursively");
    } else if(msg.startsWith("needsLocalHistory")) {
        methodNames.add((String) record.getParameters()[0]);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:FSInterceptorTest.java

示例9: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:TestLogrbResourceBundle.java

示例10: JMXLogPublisher

import java.util.logging.LogRecord; //导入方法依赖的package包/类
/**
 * Initialize publisher with the simplest formatter - just publishing the message.
 */
public JMXLogPublisher() {
	super(new Formatter(){
		@Override
		public String format(LogRecord record) {				
			return record.getMessage();
		}			
	});
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:12,代码来源:JMXLogPublisher.java

示例11: toString

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public static StringBuffer toString(LogRecord record) {
    StringBuffer sb = new StringBuffer();
    sb.append('[');
    sb.append(record.getLoggerName());
    sb.append("] THREAD: ");
    sb.append(Thread.currentThread().getName());
    sb.append(" MSG: ");
    String txt = record.getMessage();
    ResourceBundle b = record.getResourceBundle();
    if (b != null) {
        try {
            txt = b.getString(txt);
        } catch (MissingResourceException ex) {
            // ignore
        }
    }
    if (txt != null && record.getParameters() != null) {
        txt = MessageFormat.format(txt, record.getParameters());
    }
    sb.append(txt);
    Throwable t = record.getThrown();
    if (t != null) {
        sb.append('\n');
        StringWriter w = new StringWriter();
        t.printStackTrace(new PrintWriter(w));
        sb.append(w.toString().replace("\tat ", "  ").replace("\t... ", "  ... "));
    }
    sb.append('\n');
    return sb;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:NbModuleLogHandler.java

示例12: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record)
{
	String message = record.getMessage();
	Throwable exception = record.getThrown();
	Level level = record.getLevel();

	org.apache.log4j.Logger log4j = org.apache.log4j.Logger.getLogger("TomcatLog");

	// if tomcat log is not configured
	if( log4j == null )
	{
		return;
	}

	if( level == Level.SEVERE )
	{
		log4j.error(message, exception);
	}
	else if( level == Level.WARNING )
	{
		log4j.warn(message, exception);
	}
	else if( level == Level.INFO )
	{
		log4j.info(message, exception);
	}
	else if( level == Level.CONFIG )
	{
		log4j.debug(message, exception);
	}
	else
	{
		log4j.trace(message, exception);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:37,代码来源:TomcatLogRedirector.java

示例13: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
    final String msg = record.getMessage();
    if (msg != null && msg.startsWith("runTargets:")) { //NOI18N
        props.putAll((Properties)record.getParameters()[1]);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:BaseActionProviderTest.java

示例14: format

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public String format(LogRecord record) {
	return record.getLevel() + ": " 
			// + record.getSourceClassName() +": " 
			+ record.getMessage() + "\n";  
}
 
开发者ID:aswroma3,项目名称:asw,代码行数:6,代码来源:TextFormatter.java

示例15: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public final void publish(LogRecord record) {
    String recordMsg = record.getMessage();
    if (recordMsg != null && recordMsg.indexOf(this.message) != -1) {
        processLogRecord(record);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:FolderObjTest.java


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