Exception management
Exception management
I'm having some trouble handling exceptions, and am getting quite confused in the process.
I'm trying to handle my own exceptions, and I want to log them to a file. Is there a way to access the stack trace data (which smartfoxserver prints when we don't catch the exception), so that I can log it myself?
Is there a solution that works with exceptions that originate from either javascript or java?
Bascially, I want to create a high level try/catch that will catch all exceptions and log their stack trace.
I'm trying to handle my own exceptions, and I want to log them to a file. Is there a way to access the stack trace data (which smartfoxserver prints when we don't catch the exception), so that I can log it myself?
Is there a solution that works with exceptions that originate from either javascript or java?
Bascially, I want to create a high level try/catch that will catch all exceptions and log their stack trace.
well, isn't this rather problematic?
I just experienced the problem that I saw an exception on the console but did not find it in the log.
Is some information written only to the console?
I don't know if this might cause problems but I am messing around with the SFS loggers a bit in order to integrate it to my Log4J system like this:
I just experienced the problem that I saw an exception on the console but did not find it in the log.
Is some information written only to the console?
I don't know if this might cause problems but I am messing around with the SFS loggers a bit in order to integrate it to my Log4J system like this:
Code: Select all
// remove SFS log handlers
Handler[] handlers = SmartFoxServer.log.getHandlers();
if (handlers != null && handlers.length > 0) {
for (int i = 0; i < handlers.length; i++) {
SmartFoxServer.log.removeHandler(handlers[i]);
}
}
// redirect SFS logging to Log4J
SmartFoxServer.log.addHandler(new SFSLog4JLogger());
SmartFoxServer.log.setUseParentHandlers(false);If you run the server as a service everything gets logged.
That's the recommended mode for running the server in a production environment.

That's the recommended mode for running the server in a production environment.
Log4J will replace the java default logging system in the next major update.I don't know if this might cause problems but I am messing around with the SFS loggers a bit in order to integrate it to my Log4J system like this:
okay, and when not running as a service? Stacktraces get swallowed?Lapo wrote:If you run the server as a service everything gets logged.
That's the recommended mode for running the server in a production environment.
We currently have our own start script, I think because we had problems with the default one when we started.
Code: Select all
screen -h 5000 -dmS jumpjupiter java -server -Xms1024m -Xmx2048m -enableassertions -cp ${CLASSPATH} [...] it.gotoandplay.smartfoxserver.SmartFoxServer