use of java.util.logging.Logger in project OpenAM by OpenRock.
the class OpenSSOLogger method log.
public static void log(LogLevel type, Level level, String msgid, String[] msgdata, Subject logFor) {
Logger logger = (type.equals(LogLevel.ERROR)) ? LoggerFactory.getLogger(LOG_NAME + ".error") : LoggerFactory.getLogger(LOG_NAME + ".access");
if (logger.isLoggable(level)) {
try {
LogMessageProvider msgProvider = MessageProviderFactory.getProvider(LOG_MSG_XML);
LogRecord logRec = msgProvider.createLogRecord(msgid, msgdata, SubjectUtils.getSSOToken(logFor));
if (logRec != null) {
logger.log(getERecord(logRec));
}
} catch (IOException ex) {
Logger.getLogger(OpenSSOLogger.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
use of java.util.logging.Logger in project android_frameworks_base by ResurrectionRemix.
the class CookiesTest method testCookiesAreNotLogged.
/**
* Test that we don't log potentially sensitive cookie values.
* http://b/3095990
*/
public void testCookiesAreNotLogged() throws IOException, URISyntaxException {
// enqueue an HTTP response with a cookie that will be rejected
server.enqueue(new MockResponse().addHeader("Set-Cookie: password=secret; Domain=fake.domain"));
server.play();
ByteArrayOutputStream out = new ByteArrayOutputStream();
Logger logger = Logger.getLogger("org.apache.http");
StreamHandler handler = new StreamHandler(out, new SimpleFormatter());
logger.addHandler(handler);
try {
HttpClient client = new DefaultHttpClient();
client.execute(new HttpGet(server.getUrl("/").toURI()));
handler.close();
String log = out.toString("UTF-8");
assertTrue(log, log.contains("password"));
assertTrue(log, log.contains("fake.domain"));
assertFalse(log, log.contains("secret"));
} finally {
logger.removeHandler(handler);
}
}
use of java.util.logging.Logger in project Info-Evaluation by TechnionYP5777.
the class Row method add.
public <T> void add(T data) {
Logger logi = Logger.getLogger(Row.class.getName());
logi.log(Level.INFO, "Data type is: " + data.getClass().getName() + "Data is :" + data);
this.row.add(new AbstractMap.SimpleImmutableEntry<Object, Class>(data, data.getClass()));
}
use of java.util.logging.Logger in project pcgen by PCGen.
the class Logging method debugPrintLocalised.
/**
* Print localised information message if PCGen is debugging.
*
* @param message String information message (usually variable)
* @param params Object information message (usually value)
*/
public static void debugPrintLocalised(final String message, Object... params) {
Logger l = getLogger();
if (l.isLoggable(DEBUG)) {
String msg = LanguageBundle.getFormattedString(message, params);
l.log(DEBUG, msg);
}
}
use of java.util.logging.Logger in project pcgen by PCGen.
the class Logging method debugPrint.
/**
* Print the message. Currently quietly discards the Throwable.
*
* @param s String error message
* @param thr Throwable stack frame
*/
public static void debugPrint(final String s, final Throwable thr) {
debugPrint(s);
Logger l = getLogger();
if (l != null && l.isLoggable(DEBUG)) {
thr.printStackTrace(System.err);
}
}
Aggregations