I want to assign myself one of the Attachment Module ticket to work on. Since I am so new with OpenMRS platform, I am having hard-time to figure out how to debug the Module under the SDK using either Netbeans or Eclipse IDE. I also would like to configure the log4j to print out log messages. If any one have a good procedure of how to setup the IDE to debug the module, please let me know.
You need to use the remote debugging feature of your IDE. Simply start the server with
mvn openmrs-sdk:run -Ddebug=1044
Next attach a remote debugger from your IDE to port 1044.
There’s a default config of log4j shipped with OpenMRS, see here. You can adjust it, if you wish by using Log Manager Module or modify the log4j file in the war.
@dkayiwa, thank you for your reply. I need to be able to set the breakpoint in the module during the debugging stage development. In my development process, I use unit tests for code integrity and make the new code unit doesn’t break the old working one. Therefore, I like to use the IDE such as Netbeans or Eclipse to debug my code and analyze the code logic.
@oslynn unit tests are not only used for code integrity after the fact. They actually are a tremendous tool do the actual development itself, sparing you the hassle (and waste of time) of the webapp runtime debugging.
We strongly encourage you to follow the TDD approach (which, IMHO is the only way to go).
You could start here: ‘Unit Testing Conventions for more’.
Depending on the area that you intend to work on, we can point you to sample unit tests to get you going. Also those unit tests are in fact integration tests since they use Spring Testing. We are not talking about mocking everything but rather starting an entire Spring test-context with in memory database preloaded with test data.
I encourage you to try out the webapp runtime debugging as well (see @raff’s post above) , it’s important to know how to do that of course. But I cannot stress how much this is not the way to develop and troubleshoot viable Java code.
@mksd and @dkayiwa, thank you for your valuable advise. Yes, I will follow the TDD approach as you both advised. I had been using the webapp runtime debugging to study the OpenMRS code flow and understand the logic.
I am looking to assign myself the easiest ticket of the attachment module for now. Perhaps, the ATT-6, ATT-8, or ATT-9 is easy. I would like to tackle ATT-1 after that and if it still available.