Comments (5)
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.
from winston-daily-rotate-file.
@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.
I am facing the same problem which @geforcesong mentioned. So is there any way to do that in Winton?
from winston-daily-rotate-file.
+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.
Resolving #23 will address this issue.
from winston-daily-rotate-file.
Related Issues (20)
- How do I make my files append instead of overwriting when logging? HOT 2
- maxFiles is not working HOT 10
- Facing EPERM Issue while oprning file.
- After server restart new log file is created but old file is not zipped
- Not deleting old log files
- How can I determine when the file stream has finished writing? HOT 1
- On rotation the new file's owner is not always the same. Sometimes it is the user, sometimes it is root HOT 3
- Please create a few more example codes.
- winstonDailyRotateFile does not create a new file if existing file is deleted HOT 2
- Winston's audit Files are created even when no logs are printed HOT 2
- monitoring logs
- Not deleting zipped log files HOT 1
- Current log file unreadable
- Awaiting logs to be written in winston
- How to change Log Rotate Appends number to daily files,
- Ability to write headers to newly created file HOT 1
- Remove log type field from the log
- Rotating file stream not working if maxsize = 1kb or frequency is 1 minute. Does this library really works HOT 1
- Adding new Maintainers HOT 15
- Add Storage Configuration HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winston-daily-rotate-file.