Changeset: c5ad1655e8aa for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c5ad1655e8aa
Modified Files:
        java/src/nl/cwi/monetdb/client/JMonetDB.java
        java/src/nl/cwi/monetdb/merovingian/Control.java
Branch: Dec2011
Log Message:

JMonetDB: allow debuglog to be written


diffs (71 lines):

diff --git a/java/src/nl/cwi/monetdb/client/JMonetDB.java 
b/java/src/nl/cwi/monetdb/client/JMonetDB.java
--- a/java/src/nl/cwi/monetdb/client/JMonetDB.java
+++ b/java/src/nl/cwi/monetdb/client/JMonetDB.java
@@ -59,12 +59,9 @@ public class JMonetDB {
                                "Use the given hash algorithm during challenge 
response.  " +
                                "Supported algorithm names: SHA256, SHA1, 
MD5.");
                // arguments which can have zero or one argument(s)
-               copts.addOption(null, "Xdebug", CmdLineOpts.CAR_ZERO_ONE, null,
+               copts.addOption(null, "Xdebug", CmdLineOpts.CAR_ONE, null,
                                "Writes a transmission log to disk for 
debugging purposes.  " +
-                               "If a file name is given, it is used, otherwise 
a file " +
-                               "called monet<timestamp>.log is created.  A 
given file " +
-                               "never be overwritten; instead a unique 
variation of the " +
-                               "file is used.");
+                               "A file name must be given.");
 
                try {
                        copts.processArgs(args);
@@ -133,6 +130,11 @@ copts.produceHelpMessage()
                }
                // FIXME: Control needs to respect Xhash
 
+               if (copts.getOption("Xdebug").isPresent()) {
+                       String fname = copts.getOption("Xdebug").getArgument();
+                       ctl.setDebug(fname);
+               }
+
                String[] commands = copts.getOption("command").getArguments();
                if (commands[0].equals("status")) {
                        List<SabaothDB> sdbs;
diff --git a/java/src/nl/cwi/monetdb/merovingian/Control.java 
b/java/src/nl/cwi/monetdb/merovingian/Control.java
--- a/java/src/nl/cwi/monetdb/merovingian/Control.java
+++ b/java/src/nl/cwi/monetdb/merovingian/Control.java
@@ -60,6 +60,8 @@ public class Control {
        private final int port;
        /** The passphrase to use when connecting */
        private final String passphrase;
+       /** The file we should write MapiSocket debuglog to */
+       private String debug;
 
 
        /**
@@ -76,6 +78,18 @@ public class Control {
                this.passphrase = passphrase;
        }
 
+       /**
+        * Instructs to write a MCL protocol debug log to the given file.
+        * This affects any newly performed command, and can be changed
+        * inbetween commands.  Passing null to this method disables the
+        * debug log.
+        *
+        * @param filename the filename to write debug information to, or null
+        */
+       public void setDebug(String filename) {
+               this.debug = filename;
+       }
+
        private String controlHash(String pass, String salt) {
                long ho;
                long h = 0;
@@ -115,7 +129,8 @@ public class Control {
                MapiSocket ms = new MapiSocket();
                ms.setDatabase("merovingian");
                ms.setLanguage("control");
-               ms.debug("test.log");
+               if (debug != null)
+                       ms.debug(debug);
                try {
                        ms.connect(host, port, "monetdb", passphrase);
                        min = ms.getReader();
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to