Logging error on some filesystems
See original GitHub issueDetailed Description
The logging system will crash the Thorium server if it attempts to create a file that the filesystem does not support. The issue stems from the Date method in the bootstrap logs script, where the date can sometimes create a string with forward slashes. On some Mac filesystems this will be unable to create a file, and the server app will crash on every startup.
The following lines in server/src/bootstrap/logs (starting at line 16) are what need to be modified to work with all types of filesystems, and perhaps add contingencies so that the app doesn’t crash if log files can’t be made.
const access = fs.createWriteStream(
${logDir}/access.${new Date()
.toLocaleString()
.split(" “)
.join(”-“)
.split(“😊
.join(”-”)}.log, { flags: "a" } ); const error = fs.createWriteStream(
${logDir}/error.${new Date()
.toLocaleString()
.split(" “)
.join(”-“)
.split(“😊
.join(”-”)}.log, { flags: "a" } );
This is the error that is shown in the console when the problem happens.
events.js:167 throw er; // Unhandled ‘error’ event ^
Error: ENOENT: no such file or directory, open ‘/Users/johnrobe/Documents/thorium/logs/access.8/19/2018,-12-18-29-AM.log’ Emitted ‘error’ event at: at fs.open (fs.js:2253:12) at FSReqWrap.oncomplete (fs.js:171:20) logout
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
No problem - will do. Thanks for the invite to the org! I’m going to try to take on one of the help-wanted issues next, but I’m still trying to learn the codebase a bit before jumping in to make a card. Either way, excited to help!
That’s the way it’s supposed to be done! Many thanks!
If you find anything else, feel free to submit an issue. I’ve invited you to join the org, so you can go ahead and assign issues to yourself or to me, if you think I’d be better suited to solving it.