I am creating an enterprise web application. I would like to do extensive logging of both client and server activity, with all logs ultimately stored on the server. I have found many articles describing one specific strategy or tool for this, but nothing comparing the options. I know there is no single best logging strategy or tool, but what options are recommended? In what scenarios? Pros/cons?
My particular context: (although I mean the question to be general)
- Client code will be run on company workstations, not publicly on the web or on mobile devices. My team does not have easy access to these machines.
- The client browser is an instance of Internet Explorer running inside a desktop application.
- We’re already using log4net for server logging, with no complaints.
Some possible options:
- Send each log entry from the client in an AJAX call. This seems like it would add a large amount of bandwidth, but given the quickest updates on the server.
- Log to a local file on the client, and then send it to the server at the send of the session. This could minimize bandwidth, but from what I hear, browsers by design make it difficult to access the file system. I’m also not sure that this would be permitted in my current context.
- Log entries to an in-memory queue in the browser, and send multiple log entries in one AJAX call once the queue gets to a given size, or after a set time interval.
What options haven’t I considered? What would you recommend or not recommend? Why?