-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Provide New Log-File for every Boot #182
Comments
@Koenkk We should use this: https://github.com/winstonjs/winston-daily-rotate-file |
Yes that would be great! |
@Koenkk I´m testing the mentioned
Now i´m getting this type of logfile-format: Btw: Do you´v got an idea how to change path via |
Edit: Okay i think this isn´t really what we need because if i use the |
I think the easiest solution would be only changing Then we should do a automatic cleanup (e.g. only keep the 10 newest files). For the log directory I would put something in advanced:
log_directory: /var/log In const path = settings.get().advanced && settings.get().advanced.log_directory ? settings.get().advanced.log_directory : data
filename: path.joinPath(`log-${Date.now()}.txt`), |
I´m use With |
@Koenkk What do you think about this ??? :
|
Hmm .. there is something wrong with your
|
I've implemented #207. The date pattern looks good! 😄 We should keep in mind that we also need to do a cleanup (as winston wont do that anymore becuase the log file names change). |
Cool thanks. What about implemented rudimental fs.unlink function themselve or maybe use some functionality from winston-files like this ? https://github.com/winstonjs/winston/blob/master/lib/winston/transports/file.js#L563 I´v do some tests.. sadly with our solution of dynamic filename the filesize and filecount doesn´t work anymore. |
I´v do some more tests. |
I think that its easier to just keep the 10 latest logs (removing older ones once creating the logger). |
Do you mean manually remove of files? |
@tb-killa yes |
Okay sounds great. Some sort of periodic triggered function (maybe with our ping function??) who checks for the files inside our definded path and remove them via fs.unlink. This also seems that we doesnt could use any more the Winston internal functions for filesize and maxfiles. |
Yes, I think it should be on: https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/util/logger.js#L34 (only on startup). As we won't have more than 12 anyway (max 3 logs of current run, and max 9 old logs) |
@Koenkk Should we delete if files older than xx Days or xx Hours ? |
I think keeping the last 10 files (and removing other ones) is good enough for now. |
@Koenkk Please Check my Changes on: https://github.com/tb-killa/zigbee2mqtt/tree/logfile-extended
for cleanup-function is implemented by using our I am very busy in the next few weeks, so I can only look at the project from time to time, if at all. |
@Koenkk nice and thanks for your work on getting it finished. |
Yes I needed your permission in order to push to your branch. The dynamic file name causes confusion. First file looks like: log-2018-04-03-19:30:20.txt Second: Third: So I thought it would be better to just have a separate directory per run. Can this be closed? |
Okay. |
Ok, great, thanks for the effort you put into it! |
Thank you, the honour is yours ;) |
It would be better if zigbee2mqtt would provide the logfile seperated on every Start with Timestamp in Filename.
This would be the advantage for getting easier readable logfiles (and shortend too).
On every Start we generate the logfile with Name: logfile_%timenow%.log
The text was updated successfully, but these errors were encountered: