use of java.util.logging.LogRecord in project netty by netty.
the class JdkLogger method log.
/**
* Log the message at the specified level with the specified throwable if any.
* This method creates a LogRecord and fills in caller date before calling
* this instance's JDK14 logger.
*
* See bug report #13 for more details.
*/
private void log(String callerFQCN, Level level, String msg, Throwable t) {
// millis and thread are filled by the constructor
LogRecord record = new LogRecord(level, msg);
record.setLoggerName(name());
record.setThrown(t);
fillCallerData(callerFQCN, record);
logger.log(record);
}
use of java.util.logging.LogRecord in project generator by mybatis.
the class JdkLoggingImpl method error.
public void error(String s, Throwable e) {
LogRecord lr = new LogRecord(Level.SEVERE, s);
lr.setSourceClassName(log.getName());
lr.setThrown(e);
log.log(lr);
}
use of java.util.logging.LogRecord in project jersey by jersey.
the class MultiPartHeaderModificationTest method testLogMessage.
@Test
public void testLogMessage() {
final WebTarget target = target().path("multipart/ten");
MultiPartBean bean = new MultiPartBean("myname", "myvalue");
MultiPart entity = new MultiPart().bodyPart(bean, new MediaType("x-application", "x-format")).bodyPart("", MediaType.APPLICATION_OCTET_STREAM_TYPE);
final String UNSENT_HEADER_CHANGES = "Unsent header changes";
try {
target.request("text/plain").put(Entity.entity(entity, "multipart/mixed"), String.class);
assertFalse("BadRequestException can not be thrown just in case JERSEY-2341 is not fixed.", messageLogged);
LogRecord logRecord = findLogRecord(UNSENT_HEADER_CHANGES);
assertNull(logRecord);
} catch (BadRequestException brex) {
assertTrue("BadRequestException can be thrown just in case JERSEY-2341 is not fixed.", messageLogged);
LogRecord logRecord = findLogRecord(UNSENT_HEADER_CHANGES);
assertNotNull("Missing LogRecord for message '" + UNSENT_HEADER_CHANGES + "'.", logRecord);
assertThat(logRecord.getMessage(), containsString("MIME-Version"));
assertThat(logRecord.getMessage(), containsString("Content-Type"));
}
}
use of java.util.logging.LogRecord in project midpoint by Evolveum.
the class LoggingFeature method logMessage.
private static void logMessage(Logger logger, String message) {
if (!logger.isLoggable(Level.FINE)) {
return;
}
LogRecord lr = new LogRecord(Level.FINE, message);
lr.setSourceClassName(logger.getName());
lr.setSourceMethodName(null);
lr.setLoggerName(logger.getName());
logger.log(lr);
}
use of java.util.logging.LogRecord in project pcgen by PCGen.
the class PCGenStatusBar method setSourceLoadErrors.
public void setSourceLoadErrors(List<LogRecord> errors) {
if (errors != null && !errors.isEmpty()) {
int nerrors = 0;
int nwarnings = 0;
for (LogRecord logRecord : errors) {
if (logRecord.getLevel().intValue() > Logging.WARNING.intValue()) {
nerrors++;
} else if (logRecord.getLevel().intValue() > Logging.INFO.intValue()) {
nwarnings++;
}
}
if (nerrors > 0) {
loadStatusLabel.setIcon(Icons.Stop16.getImageIcon());
} else if (nwarnings > 0) {
loadStatusLabel.setIcon(Icons.Alert16.getImageIcon());
} else {
loadStatusLabel.setIcon(Icons.Ok16.getImageIcon());
}
loadStatusLabel.setToolTipText(nerrors + " errors and " + nwarnings + " warnings occurred while loading the sources");
}
}
Aggregations