This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228308

Summary: "log..." java code templates should add logger if not present
Product: editor Reporter: athompson <athompson>
Component: Completion & TemplatesAssignee: Dusan Balek <dbalek>
Status: REOPENED ---    
Severity: normal CC: athompson, cezariusz
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Mac OS X   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 252708    
Bug Blocks:    

Description athompson 2013-04-05 21:55:08 UTC
This may not be doable with the current template system, but I'll ask anyway. It would be nice if when using the logging code templates to add a log message to a java file (which requires a static logger), a static logger is automatically added if not present. The static logger should be added using the defined "logr" or "logbr" templates as appropriate, and the IDE's formatting rules could be used for determining where in the code the static logger is inserted.

This would likely require two template system enhancements, which could open the door to far more powerful (and often simpler) templates--the ability to call another template from the current template, and the ability to branch based on a condition (in this case acting only if a static logger is not yet present).
Comment 1 Martin Balin 2016-07-07 07:27:42 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 2 athompson 2016-07-07 16:03:12 UTC
I still like this idea.  :P