0

私の問題はです。予約するプログラムを書いています。このために、FilewriterとBufferedwriteを使用してtxtファイルに書き込みます。入力はsimpleInoutDialogを介して行われ、テンプレートhh:mm:ssを含む文字列を提供します。

これは、名前の例とともにtxtファイルに書き込みます。

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

私がやろうとしているのは、簡単に読めるように日付を並べ替えることです。何か助けはありますか?

4

1 に答える 1

0

はい。またはまたはを使用して、パターンを作成します。

<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>

フレームワークがメッセージを並べ替えます。

于 2012-03-08T20:48:54.050 に答える