简体   繁体   中英

How to write all javascript/Jquery exceptions to one text file?

I want to log/write all javascript errors to one text file when ever an error happens in my JavaScript functions or jQuery plugins.

For eg. PHP page call fails, undefined var.. etc. like errors happens I need to write it on a text file.

How can I do that. Please help me.

安装firebug后,您可以使用console.log进行日志记录https://getfirebug.com/

Dependes on witch browser you are using:

> Firefox? - Look at firebug http://getfirebug.com/
> Chorme? - Right Click > Inspect element
> Safari? - Preferences > Advanced > Show develop menu in menu bar
> IE? - To complicated download another browser. :)

And then use console.log(...);

每当我在javascript中遇到错误时,我都会调用我的“ LogError”函数,该函数会将错误数据传递到Web服务,然后该服务可以将其记录在服务器上或通过电子邮件发送出去,也可以通过电子邮件发送给您,或您需要的任何内容。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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