Comments (14)
Is it possible to add this feature so the current log file is alone without the date and it will rotate on date also?
So like:
current: the_log_file.log
yesterday: the_log_file.log..2017-02-07
etc?
from winston-daily-rotate-file.
I believe you should be able to set date format to '.log'.
from winston-daily-rotate-file.
@bitsofinfo to close the loop on this: the following code should get you what you're requesting:
var fileTransportOpts = {
filename: './server',
datePattern: '.log'
};
var logger = new (winston.Logger)({
transports: [
new (winston.transports.DailyRotateFile)(fileTransportOpts)
]
});
logger.log('info', 'test message');
The last line will create a file called server.log
in the current folder. Please re-open if this doesn't meet your needs.
from winston-daily-rotate-file.
datePatern
has to be inside square brackets these days and without the dot so the correct workaround is now
var fileTransportOpts = {
filename: './server',
datePattern: '[log]'
};
from winston-daily-rotate-file.
That results in: overwatch-sample-1.log..log
Setting to just log
= overwatch-sample-1.log.log
Will this still properly do rotation with this setting?
from winston-daily-rotate-file.
Please provide the code you're using. Im unable to reproduce. The sample I posted above creates appropriately named log files. Make sure that you're specifying filename
properly. In your case, it looks like you want filename: 'overwatch-sample'
and datePattern: '.log'
.
from winston-daily-rotate-file.
Yeah when I did that the name is as expected, my other question is still the main question:
Will this still properly do rotation with this setting?
from winston-daily-rotate-file.
I would expect it to rotate, assuming you have maxsize set. Obviously, it wouldn't rotate on date. Please let me know if you see different behavior.
from winston-daily-rotate-file.
Ok, if it won't do the date based rotation, not much point in using it. I really think this should support the option of the current log file having no suffix and only older log files having the date.
from winston-daily-rotate-file.
Please reopen the issue.. it would be really useful if it supports both: current file without date suffix and date based log rotation.
from winston-daily-rotate-file.
@sumitjainn the transport supports date-based log rotation. For the other piece of your request, follow #23.
from winston-daily-rotate-file.
@sumitjainn you can add two separate transports. one logs into current.log, second with DailyRotateFile support. Add some memory limit for current.log
from winston-daily-rotate-file.
Hi
is this issue solved? is there a configuration for winston to apply this behaviour ?
So like:
current: the_log_file.log
yesterday: the_log_file.log..2017-02-07
etc?
from winston-daily-rotate-file.
Try the configuration at #310, @galamo. The logs files will always have a timestamp on them, as defined by the datePattern option. However, if you need a tailable file, you can use the symlink options described in that issue (and in the README).
from winston-daily-rotate-file.
Related Issues (20)
- Symlink not created on windows10 HOT 2
- 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
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.