Employee.log=log Employee e1 = new Employee() log.info e1.add(1,2,3,4) // optional parameters in groovy log.info e1.add(2,3) log.info e1.add(2,3,10) class Employee { def static log public def add(a,b,c=3,d=10){ return a+b+c+d } }
Run result:
Tue Oct 06 19:31:50 CST 2015:INFO:10 Tue Oct 06 19:31:50 CST 2015:INFO:18 Tue Oct 06 19:31:50 CST 2015:INFO:25