darrylwest/simple-node-logger

Can't create log file in windows

Closed this issue · 3 comments

ch0c4 commented

Hi,

I try to use RollingFileLogger but I have got this issue

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'C:\_w\Autre\fauxpositif\public\log\falsepositive_2017-02-10_12:03:27.log'
    at Error (native)

I'm using windows 7 and my folder have all authorization

var log = require('simple-node-logger');

var logOptions = {
	logDirectory: __dirname + '/public/log',
	fileNamePattern: 'falsepositive_<DATE>.log',
	dateFormat: 'YYYY-MM-DD_HH:mm:ss',
};

log.createRollingFileLogger(logOptions);

I don't know what I do, create the file before logging ? Or other stuff ?

hi ch0c4. sorry, I only have access to unix based machines so I can't test for windows. feel free to fork the repo and make file adjustments to support windows if you want.

same on mac

yes, the folder does need to exist and be writable prior to calling