FileWriter로 작성된 TXT 파일의 정렬 시간
-
09-12-2019 - |
문제
내 문제는 입니다.나는 예약을위한 프로그램을 작성하고 있습니다.이를 위해 FileWriter 및 버퍼링 된 쓰기를 사용하여 TXT 파일에 씁니다.입력은 SimpleInOutDialog를 낚시하고 있습니다. 템플릿 HH : mm : ss. 문자열을 제공합니다.
이것은 txt 파일에 이름과 함께 씁니다.
예 :
.
08:00:00
Tom Hanks
06:20:00
Henry Bigs
내가하려고하는 것은 그것을 쉽게 읽을 수 있도록 날짜를 정렬하는 것입니다. 어떤 도움이 필요합니까?
해결책
예. log4j 또는 slf4j 또는 로그 백 및 패턴 만들기 :
<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>
.
프레임 워크는 메시지를 정렬합니다.
제휴하지 않습니다 StackOverflow