Web extension : add logs

I created a web extension (Firefox). I want to add logs to a external file (example: console.txt) from the content scripts and the background script. For example : write “Begin web extension”.

How can i do that? Thank you in advance for your help

You can not write to an external file. Check out https://extensionworkshop.com/documentation/develop/debugging/ for techniques of troubleshooting issues.

If you want to have a debug log for diagnostics, you would collect the logs in-memory and then offer a “download” to the user or a way to copy the log contents to the clipboard.

Hi freaktechnik,

can i write to a database ?
maybe via sql connection to a mssql database ?


br caddy

There are multiple storage facilities available:

or the DOM localStorage or indexedDB APIs.

Extensions don’t have any SQL Server libraries, so they need an intermediary such as a web application or local native application to write to SQL Server. These are both inconvenient for users to set up, so using the built-in storage facilities would be more convenient if you intend that for deployment. Well, even just for yourself…

Thanks for the answers

br caddy