Comments (8)
Your filename generator function does not accept the time parameter.
Change this and apply same change I already suggested...
from rotating-file-stream.
Hi,
the first thing I see that could be cause of unexpected behaviour is:
if (!time) time = new Date();
in your filename generator.
This will cause your program to create the log file with a name which is function of the day when your program was launched.
I strongly suggest to change it in:
if (!time)
return 'access.log';
Anyway I can't say if that is the root cause of the reported problem.
The error is clear: there is some write attempt after a close call.
RotatingFileStream will close by itself after an error... you can try to add an error event listener to check if that is the case:
accessLogStream.on('error', console.log.bind(console));
Please let me know about your progress with this issue.
Thank you,
iCC
from rotating-file-stream.
Hi man!
Any news about your issue?
from rotating-file-stream.
Hey @iccicci, thanks for your hints... I guess you're right regarding time
. Works now.
from rotating-file-stream.
let logStream = rfs((index) => {
return `${moment().format('YYYYMMDD')}.log`
}, {
interval: '1d',
path: logDir
})
i meet the same error when i wana use the date to name my logs file.
from rotating-file-stream.
@iccicci i have already read your suggestions, I‘ll update the code in the server in the midnight and check the log files later. thanks for your reply.
from rotating-file-stream.
Hi @unliar ,
any news about your issue?
from rotating-file-stream.
@iccicci everything goes well. many thanks for your help.
from rotating-file-stream.
Related Issues (20)
- [bug] File not rotating when using a generator function HOT 6
- [bug] the process deleted all log file when default file size larger than maxSize HOT 1
- Question: how to set folder to store file? HOT 1
- I am using node version 18 but still getting this error HOT 1
- Import error in node 20.11 HOT 8
- Cannot find module 'fs/promises' HOT 6
- Not able to compress log file HOT 3
- [bug] Cannot read properties of undefined (reading 'write') HOT 25
- Rotating log file with size, maxFiles and path options HOT 9
- Unhandled Error, No such file or directory, unlink called twice on same file. HOT 17
- The first rotated file is not specified time length. HOT 1
- Error: this.timeout.unref is not a function HOT 10
- while deploying the project i am getting this error please help HOT 7
- [bug] it does not create the file again when it's writing HOT 1
- Custom compressed file names HOT 4
- how do i do the unit testing in node js HOT 2
- Sometimes crashes on interval change HOT 3
- UTC: interval & intervalBoundary HOT 1
- Jumping from Node v14 to v18 between 3.1.1 and 3.2.0 HOT 6
- maxfiles seems to cause an error: Error: ENOENT: no such file or directory HOT 3
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 rotating-file-stream.