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