我的问题是。我正在编写一个计划进行预订。为此,我使用FileWriter并缓冲写入TXT文件。输入是Trough SimpleInoutDialog,它给出了一个带有模板hh:mm:ss的字符串。

本我用名字写入txt文件 示例:

08:00:00
Tom Hanks
06:20:00
Henry Bigs
.

我想做的是要对日期进行分类,以便轻松阅读它? 任何帮助?

有帮助吗?

解决方案

是。使用 slf4j Logback 并制作模式:

<configuration>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>testFile.log</file>
    <append>true</append>
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%date{HH:mm:ss} - %msg%n</pattern>
    </encoder>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="FILE" />
  </root>
</configuration>
.

framework将对您进行排序。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top