<legend id='5sy4S'><style id='5sy4S'><dir id='5sy4S'><q id='5sy4S'></q></dir></style></legend>

      <tfoot id='5sy4S'></tfoot>

        • <bdo id='5sy4S'></bdo><ul id='5sy4S'></ul>

        <small id='5sy4S'></small><noframes id='5sy4S'>

      1. <i id='5sy4S'><tr id='5sy4S'><dt id='5sy4S'><q id='5sy4S'><span id='5sy4S'><b id='5sy4S'><form id='5sy4S'><ins id='5sy4S'></ins><ul id='5sy4S'></ul><sub id='5sy4S'></sub></form><legend id='5sy4S'></legend><bdo id='5sy4S'><pre id='5sy4S'><center id='5sy4S'></center></pre></bdo></b><th id='5sy4S'></th></span></q></dt></tr></i><div id='5sy4S'><tfoot id='5sy4S'></tfoot><dl id='5sy4S'><fieldset id='5sy4S'></fieldset></dl></div>
      2. 如何在字符串数组中获取 Logger 值

        How to get Logger value in a string array(如何在字符串数组中获取 Logger 值)
        <i id='8oWzh'><tr id='8oWzh'><dt id='8oWzh'><q id='8oWzh'><span id='8oWzh'><b id='8oWzh'><form id='8oWzh'><ins id='8oWzh'></ins><ul id='8oWzh'></ul><sub id='8oWzh'></sub></form><legend id='8oWzh'></legend><bdo id='8oWzh'><pre id='8oWzh'><center id='8oWzh'></center></pre></bdo></b><th id='8oWzh'></th></span></q></dt></tr></i><div id='8oWzh'><tfoot id='8oWzh'></tfoot><dl id='8oWzh'><fieldset id='8oWzh'></fieldset></dl></div>

            <tfoot id='8oWzh'></tfoot>

              <small id='8oWzh'></small><noframes id='8oWzh'>

                <tbody id='8oWzh'></tbody>

              • <bdo id='8oWzh'></bdo><ul id='8oWzh'></ul>

                1. <legend id='8oWzh'><style id='8oWzh'><dir id='8oWzh'><q id='8oWzh'></q></dir></style></legend>
                  本文介绍了如何在字符串数组中获取 Logger 值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我使用了 log4j.Logger,并使用 FileAppender 将日志值写入了一个文件.

                  I used the log4j.Logger and I have written the log value in to a file using the FileAppender.

                  现在我想在文本区域中显示日志值.如何将记录器值分配给字符串数组?

                  Now I want to show the log value in a textarea. How can I assign the logger value to an array of Strings?

                  推荐答案

                  您可以在 Logger 中添加额外的 Appender.使用 WriterAppender 写入 StringWriter 然后将 TextArea 的内容更改为 StringWriter#toString()

                  You can add an additional Appender to your Logger. Use a WriterAppender to write to a StringWriter then you change the content of your TextArea to the value of StringWriter#toString()

                  示例代码:

                  public static void main(String[] args) {
                      Logger logger = Logger.getLogger("logger");
                      Layout layout = new PatternLayout();
                      StringWriter stringWriter = new StringWriter();
                      WriterAppender writerAppender = new WriterAppender(layout, stringWriter);
                      logger.addAppender(writerAppender);
                      TextArea textArea = new TextArea();
                  
                      logger.error("test");
                      //if(stringWriter changed){// compare to old TextArea-content?
                        textArea.setText(stringWriter.toString());
                      /
                                  
                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                  Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                  About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                  What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                  Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                  Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)

                    <tfoot id='uvcS1'></tfoot>
                      <bdo id='uvcS1'></bdo><ul id='uvcS1'></ul>
                          <tbody id='uvcS1'></tbody>
                          <i id='uvcS1'><tr id='uvcS1'><dt id='uvcS1'><q id='uvcS1'><span id='uvcS1'><b id='uvcS1'><form id='uvcS1'><ins id='uvcS1'></ins><ul id='uvcS1'></ul><sub id='uvcS1'></sub></form><legend id='uvcS1'></legend><bdo id='uvcS1'><pre id='uvcS1'><center id='uvcS1'></center></pre></bdo></b><th id='uvcS1'></th></span></q></dt></tr></i><div id='uvcS1'><tfoot id='uvcS1'></tfoot><dl id='uvcS1'><fieldset id='uvcS1'></fieldset></dl></div>

                          <legend id='uvcS1'><style id='uvcS1'><dir id='uvcS1'><q id='uvcS1'></q></dir></style></legend>

                          1. <small id='uvcS1'></small><noframes id='uvcS1'>