Fixed bug causing request/response logs to not be written to disk

This commit is contained in:
Zaid Abdulla committed 2012-12-20 23:52:45 +03:00
1 parent de7a74437a
commit 20992e8630
1 file changed
+3 -5
+3 -5
View File
@@ -132,16 +132,14 @@ if cluster.isMaster
cluster.fork() cluster.fork()
else else
if config.DEBUG if config.DEBUG
process.on('uncaughtException', (err) -> process.on('uncaughtException', (error) ->
# dump request/response logs and stack trace # dump request/response logs and stack trace
util.log("Unexpected error occured. Writing log to debug/#{currentClientIP}.log.") util.log("Unexpected error occured. Writing log to debug/#{currentClientIP}.log.")
memcached.get("debug-#{currentClientIP}", (err, l) -> memcached.get("debug-#{currentClientIP}", (err, l) ->
util.error(err) if err util.error(err) if err
fs = require 'fs' fs = require 'fs'
fs.writeFile("debug/#{currentClientIP}.log", l + "\n\n" + err.stack, (err) -> fs.writeFileSync("debug/#{currentClientIP}.log", l + "\n\n" + error.stack)
util.error(err) if err process.exit(1)
process.exit(1)
)
) )
) )