-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to rotate the file weekly & monthly? #112
Comments
Some long-overdue refactoring of the transport has occurred. A PR is available at #107. Also, a pre-release version has been published to npm. Please The option to set for monthly rotation is: Please respond back and let us know if the 2.0.0-beta isnt working for you. |
i used the datePattern: 'YYYY-MM' and it is rotating every few hours. Can you explain this behavior? Is there some documentation on the usage of the datePattern attribute? EDIT: |
@ckmax First, please confirm that you're running the 2.0.0-beta version. The documentation for the datePattern property is here in the PR: 407f0cb#diff-04c6e90faac2675aa89e2176d2eec7d8R17 Also, I am unable to reproduce the issue you're describing. A small node script like the one below appends to the same file no matter how many times I run it. var winston = require('winston');
require('winston-daily-rotate-file');
var randomString = require('./test/random-string');
var transport = new winston.transports.DailyRotateFile({
filename: 'log',
datePattern: 'YYYY-MM',
level: 'info'
});
var logger = new (winston.Logger)({
transports: [
transport
]
});
logger.info(randomString(1056));
logger.info(randomString(1056)); If you continue to see this behavior, please respond with the minimal amount of code necessary to reproduce the issue. Thanks! |
Hi,
I read through the documentation as well as the issues page and was unable to find a clear answer to this. How do you specify here the time interval in which the file rotates?
logger.add(logger.transports.DailyRotateFile, {
filename: '../NTI.log',
timestamp: true,
datePattern: 'yyyy-MM-dd.',
prepend: true,
maxSize: '10m',
level: process.env.ENV === 'development' ? 'debug' : 'info'
});
Also,
The new file that gets created since NTI.log is over 10m in size has a weird name : 'NTI.log.yyyy-11-We.' What am I doing wrong here?
Any input would help. Thanks a lot.
The text was updated successfully, but these errors were encountered: