Home > Uncategorized > Remote #ErrorLogging in C#

Remote #ErrorLogging in C#

rlc

If you are running a C# Application on a client’s machine, and can’t run the debugger on it, then instead of asking your client to send you log files whenever something goes wrong, you can use a remote logging service to record error events, and view them, and even act on them before the client complains.

This example uses RemoteLogCat.com – a logging service designed for Android, but works equally well in C# / .NET. You will need to have an API Key, and store it as a setting as “RemoteLogCat” in your web.config / app.config

public class Logging
{
public static string key = ConfigurationManager.AppSettings[“RemoteLogCat”];
    public static void Log(string channel, string log)
{
var strUrl = “http://www.remotelogcat.com/log.php?apikey={0}&channel={1}&log={2}”;
strUrl = string.Format(strUrl, key, channel, log);
var wc = new WebClient();
wc.DownloadString(strUrl);
}
}
This is then called using
Logging.Log(“MyApp”,”Your Error”)
Advertisement
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: