How to read browser logs?

Asked

Viewed 685 times

3

I am creating an html page that should display the all browser logs (console.log). So that when there is a script error I can access this page and view the browser logs.

  • 3

    You want to keep the log history? The log is on the client side, probably if you want the logs, you will have to send them to the server and save in a database, for example.

  • How do I view these logs in a simple html page via javascript?

  • You can make that happen, see here.

  • I have an offline mobile webapp, sometimes there are some script errors that cannot be seen, I would like to see these errors to fix bugs

  • Ué, but the browser console does not display errors even if offline?

  • I already needed to see in the desktop browser the mobile browser log. For this I used the remote debug functionality of Chrome. Learn more at http://tableless.com.br/debug-remoto-com-chrome-android/

  • I’ve used these features to debug while I’m developing, but sometimes there are errors when the application is in production, if the browser is Desktop I can see without problem, but when it is mobile I can’t. Why it does not have the function F12 as on the desktop. I would like to devise a way to put the log on a page via javascript. type something like Document.write() that writes directly to the page.

  • Can’t handle the exceptions of the most important blocks (try and catch, for example) and make an AJAX method to report logs to the server?

Show 3 more comments

1 answer

-1


You can overwrite the function, but have to overwrite again if the page is updated:

<script>
/* coloque aqui a funcionalidade que deseja */
console.log = function(arg){ alert(arg); };

console.log('ola');
</script>

Abcs!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.