Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom code snippet for try-catch Logger in Netbeans

Every time I use the bulb hint for adding try-catch blocks in Netbeans, it automatically adds these lines:

import java.util.logging.Level;
import java.util.logging.Logger

...
catch(...) {
   Logger.getLogger(ClassName.class.getName()).log(Level.SEVERE, null, ex);
}

I found it sort of annoying, because it also adds the necessary imports and since I'm using different logger (slf4j), I'm forced to overwrite it all the time.

Is there a way of customizing that code snippet?

like image 610
Miroslav Avatar asked Oct 19 '13 15:10

Miroslav


1 Answers

In Netbeans, go to menu option Tools -> Options -> Editor -> Hints (Tab) -> Make Sure Language Java is selected -> in the tree select "Error Fixes" - "Surround with try-catch".

And in that screen, to the right, disable the checkbox: "Use java.util.logging.Logger"

Hopefully the below screenshot makes it easier to understand these steps.

enter image description here

like image 147
Srikanth Reddy Lingala Avatar answered Oct 17 '22 04:10

Srikanth Reddy Lingala