日期:2014-05-17 浏览次数:20839 次
public class ThreadLog1 extends Thread { private static Logger logger = Logger.getLogger("file_1"); private boolean stop = false; public void run() { while(!stop){ System.out.println("I am ThreadLog1"); logger.info("I am ThreadLog1"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } public boolean isStop() { return stop; } public void setStop(boolean stop) { this.stop = stop; } }