This feature really helps me to find some bugs in my code in an easy way. I have tried this for WSO2 appfactory server and its no meter it will work for any of WSO2 products and other servers too.
First you need to start the server in debug mode. For WSO2 carbon server go to bin directory and type following command in the terminal.
./wso2server.sh –debug 5005 . You can use different port number for this.