Coder Social home page Coder Social logo

Comments (5)

kumar-b avatar kumar-b commented on June 25, 2024

Hi @mattberther,

I am trying to understand the requirement. When we reach the access4.log, then we delete the first access.log and create a new access log and log the data in this file. In this way it is difficult to know which is the latest log. Because it can be any one of them.
Log4j defines rotation policy in two ways. This way there is always a consistency that access.log will be the latest log.
https://logging.apache.org/log4j/2.x/manual/appenders.html#RolloverStrategies

Captured some snapshots from the above link.
1
2

from winston-daily-rotate-file.

mattberther avatar mattberther commented on June 25, 2024

@kumar-b would be interested in creating a rotate function (with tests) that satisfies the initial screenshot? Basically, the requirement is that access.log is always current and rotated files are in chronological order. Log4J refers to this as the "fixed window" strategy.

Once we have that, Id like to look for the best place to tie in the rotate function -- Ive done some investigation and found that rotation doesn't happen consistently either (especially when the file is buffered) and I think we'll need to do some refactoring to help with that. Isolating the rotate function in a separate class/module would help with this though.

Thoughts on the rotate api are:

function rotate(file, rotateOptions, cb) {
    this.count = rotateOptions.keep; // this comes from options.maxFiles in winston-daily-rotate-file
}

from winston-daily-rotate-file.

nayimsust avatar nayimsust commented on June 25, 2024

I am facing the same problem which @geforcesong mentioned. So is there any way to do that in Winton?

from winston-daily-rotate-file.

marchaos avatar marchaos commented on June 25, 2024

+1 for this. It seems that the current behaviour is not what exists in most other logging frameworks. Normally I would expect the latest log file to be "access.log" rather than a log file with a number appended to it.

from winston-daily-rotate-file.

mattberther avatar mattberther commented on June 25, 2024

Resolving #23 will address this issue.

from winston-daily-rotate-file.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.