用文件编写的TXT文件中排序时间
-
09-12-2019 - |
题
我的问题是。我正在编写一个计划进行预订。为此,我使用FileWriter并缓冲写入TXT文件。输入是Trough SimpleInoutDialog,它给出了一个带有模板hh:mm:ss的字符串。
本我用名字写入txt文件
示例:
.
08:00:00
Tom Hanks
06:20:00
Henry Bigs
我想做的是要对日期进行分类,以便轻松阅读它? 任何帮助?
解决方案
是。使用 log4j 或 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将对您进行排序。
不隶属于 StackOverflow