本文整理匯總了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);
}