Home Download Change log


For debugging of Java applications with some output statements like java.lang.System.err.println(), it is very annoying that the debug output does not contain the file and the line number automatically. The counterpart in C would be some self-defined output function using the C standard macros __FILE__ and __LINE__ to locate the position of the debug output statement. This implementation of dprintf for Java offer this functionality: output done via dprintf contain the file name and the line number of the output statement (when the underlying Java VM support and/or the used class files contain this information). Each dprintf-statement have a ''level'' value. Which dprintf-statements really produce some output on the console is controlled by the property DEBUG_LEVEL.




import Dprintf;

public class Test
  public static void main(String[] args)
    dprintf(1,"Hello World");
    dprintf(2,"This is the truth: %d+%d=1...",1,2);


Just import Dprintf in your Java application source code or use it directly with Dprintf.dprintf().

Note: please have a look in Dprintf.java for details!


Dprintf is currently under GPL version 2.




2009-02-13 0.02
  * initial public release

Back to top