Skip to content

Finding out why an app crashed #190

@scripting

Description

@scripting

I am adding Forever functionality to my web server, PagePark.

Basically where ever you can put web content, you can put a Node app.

We assign a port and route requests to the domain name you've declared. It works nicely, and I'm already using it in deployed apps.

My question -- how do you get a handle on the error when one of the apps crashes, ie when Forever relaunches it after an error.

I'll provide the code below that I use that I think should catch the error, but it clearly doesn't in at least some circumstances.

I got the error to show up by running the app standalone, and then the OS gave me the error and stack crawl, and I was on my way. I want the same info when Forever is managing the app.

Thanks in advance for any help.

var child = new (foreverMonitor.Monitor) (f, options);
forever.startServer (child); 
child.on ("stdout", function (linetext) { 
	addToLogFile (f, linetext);
	});
child.on ("stderr", function (data) { 
	addToLogFile (f, "pagePark on stderr: " + data.toString ());
	});
child.on ("error", function (err) {
	addToLogFile (f, "pagePark on error: " + utils.trimWhitespace (err.toString ()));
	});
child.on ("exit", function () {
	addToLogFile (f, "pagePark on exit: f == " + f + "\n");
	});
child.start ();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions