What is the best way to log javascript errors on the server?

Closed due to the fact that the essence of the question is not clear to the participants of Dmitriy Simushev , Igor , aleksandr barakin , VenZell , insolor 7 May '16 at 13:26 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Fully control errors by try {} catch (e) {} syntax so that the pages do not stop responding - Vasily Barbashev
  • 2
    Log where and better from what point of view? - Alexey Ukolov

3 answers 3

If you quickly check something, you can use console.log() Or connect third-party loggers.

  • The question is not about console.log (), but about logging JavaScript errors on the server. - user208916
  • What is the use of NodeJS? If yes, then there are many log modules npmjs.com/browse/keyword/logger . Please describe the detailed task - I will try to find the right solution. - Anton Kovylin
  • Subscribe to window.onerror.
  • Ajax send the error along with stacktrace to the server.
  • Pledge incoming error.

    In order for the client browser to report an error that has occurred, you need to contact ajax requests for help or WebSocket, which will work as a handler for any error (exception).