当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Anyone who has dealt with comple
 

 

    摘要:i recently had the opportunity to sit down with hideya kawahara, lead developer for 3d project looking glass, suns 3d desktop technology open source project on java.net. before meeting with hideya, i ......
 ·scheduling a golf tournament    »显示摘要«
    摘要:on may 1998, a post on the sci.op-research newsgroup posed the following problem: suppose you have 32 golfers who organize each week into groups of four. the original post said that the goal is to ......


Building the Ultimate Logging Solution @ JDJ
the key to java 1.4 logging is the java.util.logging.logger class. instances of this class get created on demand and may be statically referenced for the life of the application.

while many applications will only deal with a single logger instance, it may make sense for some applications to have multiple loggers. an example of this is a job scheduling server that creates a separate log file for each task (see figure 1). to split log messages between files, the server assigns a new logger instance when the task is created. the result is a much cleaner separation of events - something that can be invaluable when tracing a problem.

to obtain a logger instance, we need a unique name. keep in mind that loggers exist for the life of the application, so its very important to choose a unique name. failure to do so can result in strange or unexpected behavior. since class names must be unique, a common solution is to use the primary class name. thus a logger for the class com.example.myserver might be obtained via the following code:

logger logger = logger.getlogger("com.example.myserver");

log records explained 【推荐阅读:ClassLoader介绍

anyone who has dealt with complex enterprise applications knows the value of a good logging solution. features such as consolidating log files, separating events, and turning debugging on or off all come free with a good logging api. as a result, developers have been converting their existing system.out logging to many of the advanced solutions that have appeared on the java scene.

this article attempts to demonstrate how to convert your system.out logging to the new java 1.4 logging apis. along the way, new concepts and algorithms will be introduced to solve common interoperability issues.

using the 1.4 logger api

sending a message is a little different than printing to an outputstream. each logging message needs to contain
...   下一页
 ·the new obfuscation    »显示摘要«
    摘要: do you lock your front door at night? youre probably aware that a locked front door wont stop an accomplished thief for more than a few seconds. add another lock and you slow him down another minu......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE