简体   繁体   English

使用node.js进行客户端日志记录(可能没有模块)

[英]Client side logging using node.js(maybe without modules)

Is it clever to put a try,catch around my minified java script code and whenever someone gets an error on the client side it will send a POST to my server and writes(appends) it into a file on the server file system ? 尝试一下,赶上我最小的Java脚本代码,每当有人在客户端出现错误时,它将发送POST到我的服务器并将其写入(附加)到服务器文件系统中的文件中,是否明智?

The problem here I see is security one, everybody could POST anything to my server and cause a BufferOverflow or fill it so that nobody else could write to that log file anymore or he could write malicouse code in it !? 在这里,我看到的问题是安全性之一,每个人都可以POST任何东西到我的服务器,并导致缓冲区溢出或填充它,以便其他人可以写入到日志文件了,否则他可能写在它malicouse代码!?

What do you think? 你怎么看?

Client Errors to server side logging is a good idea if you want to be able to fix client side errors. 如果希望能够修复客户端错误,则将客户端错误记录到服务器端日志中是个好主意。

Otherwise, you'd be leaning on your own testing to catch all these errors (which you certainly won't). 否则,您将依靠自己的测试来捕获所有这些错误(当然不会)。 There's a nice blog post with code and video example showing how to implement this. 有一篇不错的博客文章,其中包含代码和视频示例,展示了如何实现此目的。 http://www.bennadel.com/blog/2542-logging-client-side-errors-with-angularjs-and-stacktrace-js.htm http://www.bennadel.com/blog/2542-logging-client-side-errors-with-angularjs-and-stacktrace-js.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM