Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Date; public class Main { /** * Print a string on console with date and invoking thread name and a newline. * @param string string to be printed */ public static void println(String string) { System.out.println("[" + new Date(System.currentTimeMillis()) + "] " + Thread.currentThread().getName() + ": " + string); } /** * Util method: getName of executing thread * @return invoking thread name */ public static String getName() { return Thread.currentThread().getName(); } }