This is in package org.jtrix.project.libjtrix.debug. It is used to output messages at various ``levels'', and the developer can then select which levels they want to see when they run the application.
To turn debugging on fully and use it we use something like these lines:
// Enable debug output. The arguments are an identifier string, the bits // to enable, and the bits to disable. -1 as the first argument means // enable all arguments. There are 63 useful bits (it's a long). At the // time of writing these include INFO and WARN among others. Debug.set("My netlet", -1, 0); // The msg() method outputs a debug message at the appropriate level. // The first argument is the level, the second is the object being // debugged. Subsequent arguments are turned into strings and are output // as the debug message. Here are two examples. Debug.msg(Debug.INFO, this, "Inside initialise() with bean: ", _bean.toString()); Debug.msg(Debug.INFO, this, "Binding service..."); // Here's a special Debug method to handle debugging an exception. try { // Some code } catch (Exception e) { Debug.exc(this, e, "Some code failed"); // Handle exception }
Only after first setting debugging will we get any debug output, and then it will appear in the node running the application. Without this only things explicitly printed to standard output will be seen.
We could also use the dmesg command as described above.
Beatrix provides some additional help with this class, including a command line option to set the debug level when we launch an application. See Programming with Jtrix: The Beatrix application framework for more details.
Nik Silver 2002-03-09