本文整理汇总了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);
}
}
示例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);
}
示例3: log
import java.util.logging.LogRecord; //导入方法依赖的package包/类
public void log(LogRecord logRecord) {
logRecord.setMessage("[GC] [" + getName() + "] " + logRecord.getMessage());
super.log(logRecord);
}
示例4: log
import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void log(LogRecord record) {
record.setMessage("[" + plugin.getName() + "] " + "[" + id + "] " + record.getMessage());
super.log(record);
}
示例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;
}
示例6: publish
import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
record.setMessage("[" + (System.currentTimeMillis() - startTimeMillis) + " ms.] " + record.getMessage()); // NOI18N
}
示例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();
}
}
}
示例8: log
import java.util.logging.LogRecord; //导入方法依赖的package包/类
@Override
public void log(LogRecord logRecord) {
logRecord.setMessage(this.prefix + logRecord.getMessage());
super.log(logRecord);
}