Open Tpessia opened 3 years ago
Hey guys! Seems like the delete_old function is unable to delete retained logs on Windows with these PM2 configs:
{ "apps": [{ "name": "server", "logDateFormat": "YYYY-MM-DD HH:mm:ss Z", "errorFile": "./logs/server-err.log", "outFile": "./logs/server-out.log", "mergeLogs": true, "script": "./index.js" }] }
The problems appears to be related to this line: var fileBaseName = file.substr(0, file.length - 4).split('/').pop() + "__";
On my machine the split fails because the path has "\" and not "/".
Because of that the following line fails to match the path, and no file is queued for deletion: if (files[i].indexOf(fileBaseName) >= 0)
Hey guys! Seems like the delete_old function is unable to delete retained logs on Windows with these PM2 configs:
{ "apps": [{ "name": "server", "logDateFormat": "YYYY-MM-DD HH:mm:ss Z", "errorFile": "./logs/server-err.log", "outFile": "./logs/server-out.log", "mergeLogs": true, "script": "./index.js" }] }
The problems appears to be related to this line: var fileBaseName = file.substr(0, file.length - 4).split('/').pop() + "__";
On my machine the split fails because the path has "\" and not "/".
Because of that the following line fails to match the path, and no file is queued for deletion: if (files[i].indexOf(fileBaseName) >= 0)