Once your module is installed all error messages are sent to your (NetBeans user directory)/var/log/messages.log use that for watching what's going on.

You can use the ErrorManager API (very easy to use, by the way) to report exceptions and informational messages to the log file.

You can as well start NetBeans in debug mode using

netbeans/bin/netbeans -J-Xdebug -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5858

and then attach your IDE (NetBeans, of course ;-)) using the Run/Attach Debugger and then choose "Connector=SocketAttach", "port=5858" and "timeout=5000" and press OK. Then you can set breakpoints as usual.

Source: NetBeans FAQ