Skip to content

Log file name style #143

Closed

Description

@zuston

About logforth's log file name style, is it possible to be aligned with the log4j's style. Like the following screenshot

Image

Nit: the latest log name is always be the xxx.log , that will make user easy to get the latest log file.

Activity

  1. zuston commented on Jul 10, 2025

    @zuston
    ContributorAuthor
  2. tisonkun commented on Jul 10, 2025

    @tisonkun
    Contributor

    Sounds reasonable. Would you like to submit a patch?

  3. zuston commented on Jul 10, 2025

    @zuston
    ContributorAuthor

    Sounds reasonable. Would you like to submit a patch?

    Sure.

  4. added theissue type on Jul 30, 2025
  5. tisonkun commented on Jul 31, 2025

    @tisonkun
    Contributor

    @zuston could you provide a link to how log4j (and perhaps logback) name their files?

    I'm feeling that it's a bit complex when we have two demisions in consider: datetime and num (rotated by size).

    That said, we can of course have:

    server.log
    server.log.1
    server.log.2
    ...
    

    and

    server.2025-08.log
    server.2025-08.log.1
    server.2025-09.log
    

    In the second situation, we have two .log files without any number. And sorting these files can be a bit complex if you want it.

  6. zuston commented on Aug 1, 2025

    @zuston
    ContributorAuthor

    could you provide a link to how log4j (and perhaps logback) name their files?

    https://logging.apache.org/log4j/2.x/manual/appenders/rolling-file.html#RolloverStrategy-index

    I'm feeling that it's a bit complex when we have two demisions in consider: datetime and num (rotated by size).

    +1. I'm not sure whether logforth could provide a pluggable rolling policy, that means I could implement it by myself if logforth don't want to maintain this.

  7. tisonkun commented on Sep 6, 2025

    @tisonkun
    Contributor
  8. tisonkun commented on Sep 6, 2025

    @tisonkun
    Contributor

    We'll

    1. Rename filename_prexfix to filename and make it required.
    2. Calculate the highest counter value and set current_count.
    3. Make the current file name <filename>.<filename_suffix>
    4. Create <filename>.<date>.<cnt>.<filename_suffix> on rolling over.
  9. tisonkun commented on Sep 6, 2025

    @tisonkun
    Contributor

    We need to implement

    • Calculate the highest counter value and set current_count.
    • Matching <filename>.<date>.<cnt>.<filename_suffix> and sort with (date, cnt).
  10. tisonkun commented on Sep 7, 2025

    @tisonkun
    Contributor

    Implementing at #159

    @zuston welcome to give a review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions