tag:blogger.com,1999:blog-4291444454941265221.post7537762313052164588..comments2010-09-21T02:41:14.685-07:00Comments on MyJavaExperience: Log log log and always log !Paolo Brunastihttp://www.blogger.com/profile/13331179843007617054noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4291444454941265221.post-3529843550806660512010-09-21T02:41:14.685-07:002010-09-21T02:41:14.685-07:00Just a quick format reference:
Conversion Charact...Just a quick format reference:<br /><br />Conversion Character Effect<br />c - category of the logging event<br />C - fully qualified class name of the caller issuing the logging request<br />d - date of the logging event. <br /> The date conversion specifier may be followed by a date format, for example, %d{HH:mm:ss,SSS} or %d{dd MMM yyyy HH:mm:ss,SSS}<br />F - file name where the logging request was issued.<br />l - location information of the caller<br /> The location information can be very useful. However, its generation is extremely slow and should be avoided.<br />L - line number from where the logging request was issued.<br /> Caller location information is extremely slow and should be avoided.<br />m - application supplied message associated with the logging event.<br />M - method name where the logging request was issued.<br />n - platform dependent line separator character or characters.<br />p - priority of the logging event.<br />r - number of milliseconds elapsed from the construction of the layout until the creation of the logging event.<br />t - name of the thread that generated the logging event.<br />x - NDC (nested diagnostic context)<br />X - MDC (mapped diagnostic context) - must be followed by the key for the map placed between braces, as in %X{clientNumber}<br />% - The sequence %% outputs a single percent sign.Paolo Brunastihttps://www.blogger.com/profile/13331179843007617054noreply@blogger.comtag:blogger.com,1999:blog-4291444454941265221.post-38358110447083307952010-09-17T07:10:32.589-07:002010-09-17T07:10:32.589-07:00By the way:
Brian W. Kernighan and Rob Pike in &q...By the way:<br /><br />Brian W. Kernighan and Rob Pike in "The Practice of Programming":<br /><br />"As personal choice, we tend not to use debuggers beyond getting a stack trace or the value of a variable or two. One reason is that it is easy to get lost in details of complicated data structures and control flow; we find stepping through a program less productive than thinking harder and adding output statements and self-checking code at critical places. Clicking over statements takes longer than scanning the output of judiciously-placed displays. It takes less time to decide where to put print statements than to single-step to the critical section of code, even assuming we know where that is. More important, debugging statements stay with the program; debugging sessions are transient."<br /><br />I too prefer log to debug... the problem is to make "judiciously-placed displays" ! <br /><br />and of course read : http://logging.apache.org/log4j/1.2/manual.htmlPaolo Brunastihttps://www.blogger.com/profile/13331179843007617054noreply@blogger.com