Question

My problem is. I am writing a program to make reservations. For this I use Filewriter and Buffered write to write it to a txt file. The input is trough simpleInoutDialog and It gives a string with the template hh:mm:ss.

This I write to the txt file along with a name example:

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

What I'm trying to do is to sort the date so I can read it easily? Any help?

Was it helpful?

Solution

Yes. Use or or and make pattern:

<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 will sort messages for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top