2

Basically:

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)

  • Using ASP.NET, with C# on the server and JavaScript on the client.
  • 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?

  • 2
    From a security perspective - would you really want clients to be able to send "log" statements to your server? – Pete Sep 23 '16 at 23:56
  • How else are we going to know how the client is performing? – JamesFaix Sep 24 '16 at 1:08
  • Do you need to trace what's going on at every client? Or just to stay aware of errors and possible bugs? – Laiv Sep 24 '16 at 11:34
  • The major aim is for debugging. Logging errors is a very high priority, but I would also like to have some tracing throughout the application, to give more context of the client state leading up to errors. – JamesFaix Sep 24 '16 at 15:51
  • Instead of regular reports (logs) from client to server. Why don't allow client to switch on and off the logger?. When you need to give support to the user you ask him for switch on the logger, to reproduce the error (or any other scenario) and submit to the server. During the process, logs can be stored either in memory or in sqllite (or similars solutions compatible with IE) – Laiv Sep 25 '16 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.