-
Notifications
You must be signed in to change notification settings - Fork 38
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
createRollingFileLogger() makes my app to hang #36
Comments
Please check the open files, in my case same file open many times. Hence it will lead to handup of your app |
Not sure if this is related but this code creates an interval that kept mocha from exiting cleanly. I cannot find a place where const startRollTimer = function() {
rollTimer = createInterval(function() {
if (appender.checkForRoll()) {
openWriter();
}
}, 60 * 1000);
}; I needed to add this method to my LogManager wrapper. It is a workaround, but it does allow my mocha tests to complete without the close() {
(manager.getAppenders()).forEach(appender => {
if (appender.__protected) {
let rollTimer = appender.__protected()['rollTimer']
if (rollTimer) {
clearInterval(rollTimer)
}
}
})
} Maybe the (I would also add a back off to /**
* call formatter then write the entry to the console output
* @param entry - the log entry
*/
this.write = function(entry) {
if (levels.indexOf( entry.level ) >= currentLevel) {
if (appender.checkForRoll()) {
openWriter();
}
const writer = getWriter();
if (writer) {
writer.write( appender.formatter( entry ) );
} else {
/*eslint no-console: "off"*/
console.log( 'no writer...' );
}
}
}; |
This makes it unusable for CLI scripts, especially for scripts aimed for cron jobs.
The process hangs and even EDIT At the examples, I can see in the https://github.com/darrylwest/simple-node-logger/blob/master/examples/rolling-logger.js#L27 there is an one second timeout that exists the process, so, I assume this is intended behaviour. It's inconvenient, but it works. EDIT @pbbadenhorst the |
I'm writing a node CLI app, let's call it toto.js
When I use the
createSimpleLogger
and execute my apptoto start
It runs it perfectly, create the log files + console logs and terminate the app.
When I switch to
createRollingFileLogger
, it creates the logs inside the file - no console logs -, execute the app, but doesn't exit the app anymore, it just hangs and I have toCTRL+C
to terminate the app.Any ideas on why?
Here's the config I use for both loggers :
The text was updated successfully, but these errors were encountered: