0
我是Groovy腳本編程的新手。爲了排除故障/調試目的,我想將這些信息寫入日誌文件中。我必須按照以下骨架編寫我的實際代碼。登錄Groovy
import java.util.List;
import com.test.build.api.scripting.XXX;
**import import java.util.logging.Logger**
class MyTest
{
**static Logger logger = Logger.getLogger (MyClass.class.getName());**
def init()
{
// HERE I WANT TO LOG THAT INIT WAS CALLED
}
def destroy()
{
}
def process(List<XXX> xxxy)
{
// Reuse following skeleton for processing events
try
{
// Do Something
// HERE I WANT TO LOG THAT SOMETHING WAS DONE ABOVE
// Do Something
// HERE I WANT TO LOG THAT SOMETHING WAS DONE ABOVE
// Do Something
// HERE I WANT TO LOG THAT SOMETHING WAS DONE ABOVE
// Do Something
}
}
catch(InterruptedException e)
{
return
}
}
}
這一切我要登錄一個文件即C:\ TEMP \ myscripting.log
有人能幫助我嗎?
http://stackoverflow.com/questions/19868180/groovy-script-and-log4j –