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


Java LogRecord.setMessage方法代码示例

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


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

示例1: event

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void event(MT type, Object o)
{
    try 
    {
        LogRecord r = new LogRecord(Level.INFO, type.toString());
        switch (type)
        {
            case FINISH_LEFT:         r.setMessage(String.format("L+%03.3f", ((ColorTime)((Object[])o)[0]).time)); break;
            case FINISH_RIGHT:        r.setMessage(String.format("          R+%03.3f", ((ColorTime)((Object[])o)[0]).time)); break;
            case DELETE_FINISH_LEFT:  r.setMessage(              "L-DELETE"); break;
            case DELETE_FINISH_RIGHT: r.setMessage(              "          R-DELETE"); break;
        }
        audit.publish(r);
    }
    catch (Exception e)
    {
        log.log(Level.INFO, "audit log error: {0}", e);
    }
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:21,代码来源:AuditLog.java

示例2: log

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void log(LogRecord record) {
    record.setMessage(this.prefix + record.getMessage());

    // Don't trust loggers to show anything below INFO.
    // Check the level ourselves and then promote the record
    // to make sure it gets through.
    if(record.getLevel().intValue() < Level.INFO.intValue() &&
       record.getLevel().intValue() >= getEffectiveLevel().intValue()) {

        record.setLevel(Level.INFO);
    }

    super.log(record);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:16,代码来源:ClassLogger.java

示例3: log

import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void log(LogRecord logRecord) {
    logRecord.setMessage("[GC] [" + getName() + "] " + logRecord.getMessage());
    super.log(logRecord);
}
 
开发者ID:Dragovorn,项目名称:gamecraft,代码行数:5,代码来源:GameLogger.java

示例4: log

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void log(LogRecord record) {
    record.setMessage("[" + plugin.getName() + "] " + "[" + id + "] " + record.getMessage());
    super.log(record);
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:6,代码来源:Registry.java

示例5: annotate

import java.util.logging.LogRecord; //导入方法依赖的package包/类
/** Calls all delegates. */
public Throwable annotate(
    Throwable t, int severity, String message, final String localizedMessage, Throwable stackTrace,
    java.util.Date date
) {
    if (delegates.isEmpty()) {
        LogRecord rec = new LogRecord(convertSeverity(severity, true, Level.ALL), message);
        if (stackTrace != null) {
            rec.setThrown(stackTrace);
        }
        if (date != null) {
            rec.setMillis(date.getTime());
        }
        if (localizedMessage != null) {
            ResourceBundle rb = new ResourceBundle() {
                public Object handleGetObject(String key) {
                    if ("msg".equals(key)) { // NOI18N
                        return localizedMessage;
                    } else {
                        return null;
                    }
                }
                
                public Enumeration<String> getKeys() {
                    return Enumerations.singleton("msg"); // NOI18N
                }
            };
            rec.setResourceBundle(rb);
            rec.setMessage("msg"); // NOI18N
        }
        
        AnnException ann = AnnException.findOrCreate(t, true);
        if (ann != null) {  //#148778 - Although ann should not be null, it was reported it can happen.
            ann.addRecord(rec);
        }
        
        return t;
    }
    
    for (ErrorManager em : delegates) {
        em.annotate(t, severity, message, localizedMessage, stackTrace, date);
    }

    return t;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:ErrorManager.java

示例6: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
    record.setMessage("[" + (System.currentTimeMillis() - startTimeMillis) + " ms.] " + record.getMessage()); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:Logger.java

示例7: publish

import java.util.logging.LogRecord; //导入方法依赖的package包/类
/**
 * Enqueues the record for the write thread.
 */
@Override
public void publish(LogRecord record) {
    if (open) {
        if (maxQueueSize > 0) {
            int size = queue.size();
            if (size >= throttleThreshold) {
                if (size < maxQueueSize) {
                    if (record.getLevel().intValue() < Level.INFO.intValue()) {
                        return;
                    }
                } else {
                    return;
                }
            }
        }
        Object[] params = record.getParameters();
        if ((params != null) && (params.length > 0)) {
            String msg = record.getMessage();
            if ((msg != null) && (msg.length() > 0)) {
                Object param;
                for (int i = params.length; --i >= 0; ) {
                    param = params[i];
                    if (param instanceof String) {
                        continue;
                    } else if (param instanceof Integer) {
                        continue;
                    } else if (param instanceof Boolean) {
                        continue;
                    } else if (param instanceof Byte) {
                        continue;
                    } else if (param instanceof Character) {
                        continue;
                    } else if (param instanceof Date) {
                        continue;
                    } else if (param instanceof Double) {
                        continue;
                    } else if (param instanceof Enum) {
                        continue;
                    } else if (param instanceof Float) {
                        continue;
                    } else if (param instanceof Long) {
                        continue;
                    } else if (param instanceof Short) {
                        continue;
                    } else if (param instanceof Calendar) {
                        params[i] = ((Calendar) param).clone();
                    } else if (param instanceof Number) {
                        Formatter formatter = getFormatter();
                        if (formatter != null) {
                            record.setMessage(formatter.formatMessage(record));
                        } else {
                            record.setMessage(String.format(msg, params));
                        }
                        record.setParameters(null);
                        break;
                    } else {
                        params[i] = param.toString();
                    }
                }
            }
        }
        synchronized (queue) {
            queue.addLast(record);
            queue.notify();
        }
    }
}
 
开发者ID:a-hansen,项目名称:alog,代码行数:71,代码来源:AsyncLogHandler.java

示例8: log

import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void log(LogRecord logRecord) {
    logRecord.setMessage(this.prefix + logRecord.getMessage());
    super.log(logRecord);
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:6,代码来源:ModuleLogger.java


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