We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在Logger的这个方法,如果在写入日志文件发生异常,代码就会走到后面一段,即从queue里poll出日志然后System.out.print输出,然后Tars的日志系统把System的out/err都冲定向到这个LoggingOutputstream,而这个流的flush方法,就是调用Logger的info方法,最终就是offer一个日志到这个queue里,然后发生死循环,一边offer一边poll。
private void writeAllToLocal(String file) { boolean succ = false; if (file != null) { BufferedWriter bw = null; try { if (!logQueue.isEmpty()) { bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file + "." + Utils.getDateSimpleInfo(System.currentTimeMillis()), true), "UTF-8")); LogItem item = null; while ((item = logQueue.poll()) != null) { bw.write(item.toString()); } } succ = true; } catch (IOException ex) { } finally { if (bw != null) { try { bw.close(); } catch (IOException e) { } } } } if (!succ) { LogItem item = null; while ((item = logQueue.poll()) != null && !STDOUT_LOG.equals(name)) { System.out.print("\t" + item.toString()); } } }
The text was updated successfully, but these errors were encountered:
使用Idea 查看项目依赖图,删除循环依赖问题
Sorry, something went wrong.
?没懂。
这里最终输出的是 System.out.print,在STDOUT_LOG.equals(name) 判断了,所以stderr输出后。到这里就不会再输出了。只会输出一次
No branches or pull requests
在Logger的这个方法,如果在写入日志文件发生异常,代码就会走到后面一段,即从queue里poll出日志然后System.out.print输出,然后Tars的日志系统把System的out/err都冲定向到这个LoggingOutputstream,而这个流的flush方法,就是调用Logger的info方法,最终就是offer一个日志到这个queue里,然后发生死循环,一边offer一边poll。
The text was updated successfully, but these errors were encountered: