http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/doc-files/logging.htmlpublic static void main(String[] args) { ResourceBundle rb = ResourceBundle.getBundle("your.package.Log"); int sum = 0; for (int i = 0; i < 10; i++) { LogRecord r = new LogRecord(Level.INFO, "MSG_Add"); r.setResourceBundle(rb); r.setParameters(new Object[] { sum, i }); Logger.global.log(r); sum += i; } LogRecord r = new LogRecord(Level.INFO, "MSG_Result"); r.setResourceBundle(rb); r.setParameters(new Object[] { sum }); Logger.global.log(r);}
1 回答
慕桂英4014372
TA贡献1871条经验 获得超13个赞
Logger.global
已弃用。如果您将记录器行更改为(<YOUR CLASS>
显然更改为您的班级名称)
Logger.getLogger(<YOUR CLASS>.class.getName()).log(r);
然后记录的行将出现在 NetBeans 的输出选项卡中
添加回答
举报
0/150
提交
取消