當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。