Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
log.fine( "Let's display some object in debug: " + myObject );
if( log.isLoggable( Level.FINE ) ) {
log.fine( "Let's display some object in debug: " + myObject );
}
if( log.isLoggable( Level.FINE ) ) {
log.fine( "Let's display some object in debug: " + (myObject != null ? myObject.toString() : "null") );
}
log.debug( "Let's display some object in debug: {}", myObject );
public class TestNull {
public static void main(String[] args) {
String s = null;
System.out.println("!"+s);
}
}!nulllog.context(remoteHostAddress).log("Transport packet received:\n" + Util.dumpBytes(packetBytes));
} catch (Exception ex) {
log.log(Level.SEVERE, "Exception: ", ex);
}
// Create new long varibale and assign current timestamp to it
Long time = new Long(System.currentTimeMillis());
ERROR 2011-10-13 16:43:56,643 [ProxyUtils] Exception: NumberFormatException
ERROR 2011-10-13 16:43:56,643 [ProxyUtils] Failed to parse user's input: NumberFormatException
ERROR 2011-10-13 16:43:56,648 [ProxyUtils] Failed to load proxy configuration: NullPointerException
Логирование в Java / quick start