caaspaper / caas

Cache as a Service
2 stars 0 forks source link

Creating log files in addition to debugger #8

Open hyori opened 11 years ago

hyori commented 11 years ago

Hey dudes,

What if we added in AdminNode.java the capability to log files in case stuff goes wrong?

simonsmiley commented 11 years ago

we could use Logger from the java api... but I've never used it before....

acgessler commented 11 years ago

We should make this a very general listening interface: the admin node produces a continuous stream of status messages, which is send to a set of listeners registered with the admin node Listeners can be either remote listeners (the GUI connecting to a remote process) or local ones that either output stdout or write to a log file. This way we have no duplication.

This is the pattern that I see being used in most bigger projects.

acgessler commented 11 years ago

i.e

interface IDebugListener {

    public void write(string message);
}

class DebugListenerSet extends ArrayList<IDebugListener> {

   public void write(string message) {
       for(IDebugListener listener : this) {
           listener.write(message);
       }
   }
}

:dancers: and AdminCacheNode then maintain a DebugListenerSet and write to that instead of println. IDebugListener then be implemented for handling different destinations, such as : log file, sysout, remote connection to admin cache node.

The remote debugging via the admin needs a more elaborate API built on top of that because we also must transfer the grid and other data structures.