This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.


  Remote Debugging Online Applications
  Submitted by

I think most of us are aware of the fact that debugging a running online application is a pretty difficult task if it was not identified in the beginning. Designing the application in such a manner as to centralize all kinds of debugging output is the key in this scenario. This idea was implemented in my current project so i thought it is worth to share here.

My current application required 3 kinds of output targets.

1. Console (Important but not usable)
2. Socket (Provides real-time feedback)
3. File Stream (Good for reviewing the problem)

My application was a sort of a Proxy server that has to run as a Daemon Service and provides facilities to connected users, so after launching the application and closing the Console i was unaware what kind of errors are being generated by my application so i required a mechanism through which i can connect on my Server and can check the current activity of the debugging. Also if someone came to me that at a particular instance of time the application didnt behave as required then i need to review the previous generated debugged output, for that i need a persistent file stream.

So in this case what i did was basically very simple, i centralized all my debugging output through a single class QDebugOut (The source is in Java but i think we can get the general idea)

class QDebugOut
   public static void LogIt(String str)

private static void LogItConsole(String str) { System.out.println(str); }

private static void LogItConnection(String str) { // Go through all the connections // Write the given String(str) // Flush the stream // Loop }

private static void LogItStream(String str) { // Write it in a File Stream } }

So now that i have centralized all my debugging output i can do something like this in my main code

public class MainClass
    public void SomeFunction()
            // A line that generates an Exception
        catch(Exception e)
             QDebugOut.LogIt("Error has occured"+e);

So now i can see every generated Debugging error wherever / whenever it suits me.


The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.