|
|
@ -23,25 +23,25 @@ public class DesignerLogAppendThread extends Thread{ |
|
|
|
|
|
|
|
|
|
|
|
public DesignerLogAppendThread() { |
|
|
|
public DesignerLogAppendThread() { |
|
|
|
Logger root = Logger.getRootLogger(); |
|
|
|
Logger root = Logger.getRootLogger(); |
|
|
|
// 获取子记录器的输出源
|
|
|
|
// 获取子记录器的输出源
|
|
|
|
Appender appender = root.getAppender("design"); |
|
|
|
Appender appender = root.getAppender("design"); |
|
|
|
// 定义一个未连接的输入流管道
|
|
|
|
// 定义一个未连接的输入流管道
|
|
|
|
reader = new PipedReader(); |
|
|
|
reader = new PipedReader(); |
|
|
|
// 定义一个已连接的输出流管理,并连接到reader
|
|
|
|
// 定义一个已连接的输出流管理,并连接到reader
|
|
|
|
Writer writer = null; |
|
|
|
Writer writer = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
writer = new PipedWriter(reader); |
|
|
|
writer = new PipedWriter(reader); |
|
|
|
// 设置 appender 输出流
|
|
|
|
// 设置 appender 输出流
|
|
|
|
((WriterAppender) appender).setWriter(writer); |
|
|
|
((WriterAppender) appender).setWriter(writer); |
|
|
|
} catch (Throwable e) { |
|
|
|
} catch (Throwable e) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
// 不间断地扫描输入流
|
|
|
|
// 不间断地扫描输入流
|
|
|
|
Scanner scanner = new Scanner(reader); |
|
|
|
Scanner scanner = new Scanner(reader); |
|
|
|
|
|
|
|
|
|
|
|
// 将扫描到的字符流打印在屏目
|
|
|
|
// 将扫描到的字符流打印在屏目
|
|
|
|
while (scanner.hasNext()) { |
|
|
|
while (scanner.hasNext()) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
Thread.sleep(100); |
|
|
|
Thread.sleep(100); |
|
|
|