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()
else
if config.DEBUG
process.on('uncaughtException', (err) ->
process.on('uncaughtException', (error) ->
# dump request/response logs and stack trace
util.log("Unexpected error occured. Writing log to debug/#{currentClientIP}.log.")
memcached.get("debug-#{currentClientIP}", (err, l) ->
util.error(err) if err
fs = require 'fs'
fs.writeFile("debug/#{currentClientIP}.log", l + "\n\n" + err.stack, (err) ->
util.error(err) if err
process.exit(1)
)
fs.writeFileSync("debug/#{currentClientIP}.log", l + "\n\n" + error.stack)
process.exit(1)
)
)