the org.apache.log4j.PatternLayout java doc
	
    
    
	
A flexible layout configurable with pattern string. 
The goal of this class is to format
 
a LoggingEvent
 
and return the results as a String. The results depend on the conversion 
pattern
. 
The conversion pattern is closely related to the conversion pattern of the 
printf function in C. A conversion pattern is composed of literal text and 
format control expressions called conversion specifiers
. 
You are free to insert any literal text within the conversion pattern.
 
Each conversion specifier starts with a percent sign (%) and is followed by 
optional format modifiers
 and a conversion character
. The 
conversion character specifies the type of data, e.g. category, priority, date, 
thread name. The format modifiers control such things as field width, padding, 
left and right justification. The following is a simple example. 
Let the conversion pattern be "%-5p [%t]: %m%n"
 and assume that the 
log4j environment was set to use a PatternLayout. Then the statements 
   Category root = Category.getRoot();
   root.debug("Message 1");
   root.warn("Message 2");
   
would yield the output 
   DEBUG [main]: Message 1
   WARN  [main]: Message 2
   
Note that there is no explicit separator between text and conversion 
specifiers. The pattern parser knows when it has reached the end of a conversion 
specifier when it reads a conversion character. In the example above the 
conversion specifier %-5p
 means the priority of the logging event should 
be left justified to a width of five characters. The recognized conversion 
characters are 
Conversion Character
Effect
c
Used to output the category of the logging event. The category conversion 
specifier can be optionally followed by precision specifier
, that is a 
decimal constant in brackets.
If a precision specifier is given, then only the corresponding number of 
right most components of the category name will be printed. By default the 
catego
    
     
	
	
    
    
	Ïà¹ØÎĵµ£º
        
    
    package test
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
public class ReadSelectedLine{
    // ¶ÁÈ¡ÎļþÖ¸¶¨ÐС£
    static void readAppointedLineNumber(File sourceFile, int lineNumber)
            throws IOException {
         ......
	
    
        
    
    javaÓïÑÔÊǽâÊÍÖ´ÐУ¬javaÔ´ÂëÊÇͨ¹ý±àÒëÉú³ÉÒ»ÖÖÌØÊâµÄ.classµÄÖмä×Ö½âÂëÎļþ£¬È»ºóÔÙÓÐJVM½øÐнâÊÍÖ´ÐС£
javaÓïÑÔ¶ÔÖ¸Õë½øÐÐÁËÉϲãµÄ·â×°£¬Ëü±£Ö¤Äܹ»Í¨¹ýÕâ¸öÖ¸Õ루ÒýÓã©£¬À´·ÃÎÊÓÐЧµÄÄÚ´æµ¥Ôª¡£
javaÓïÑÔ²»ÔÊÐí¶à¼Ì³Ð£¬Ê¹¼Ì³Ð¹ØÏµ³ÉÊ÷װͼ£¬Ã¿¸öÀà¶¼Ö»ÄÜÓÉÒ»¸ö¸¸Àà¡£
javaÓïÑԵĿª·¢Ð§Âʸߣ¬µ«Ö´ÐÐЧÂʵ͡££¨Ïൠ......
	
    
        
    
    ÃæÏò¶ÔÏóµÄ˼Ïë
anything is Object£¨ÍòÎï½Ô¶ÔÏó£©
³éÏ󣬴ӶԾßÌåµÄ¶ÔÏóÖгéÈ¡ÓÐÓÃÐÅÏ¢¡£
¶ÔÏóÓÐÆä¹ÌÓÐÊôÐÔ£¬¶ÔÏóµÄ·½·¨£¬¼´¶ÔÏóµÄÐÐΪ£¨¶ÔÏóÄÜ×öʲô£©
¶ÔÏó±¾ÉíÊǼòµ¥µÄ£¨¹¦Äܼòµ¥£©£¬¶à¸ö¶ÔÏó¿ÉÒÔ×é³É¸´ÔÓµÄϵͳ£¨¶ÔÏóÖ®¼ä±Ë´Ëµ÷ÓöԷ½µÄ·½·¨£©
¶ÔÏóÓ¦µ±ÊǸ÷˾ÆäÖ°£¨¹¦Äܼòµ¥£©£¬¸÷¾¡ËùÄÜ£¨°Ñ×Ô¼ºµÄ¹¦ÄÜ×÷µ½×îºÃ£© ......
	
    
        
    
    Ò»¡¢±à¼JavaÔ´Îļþ
=============================================
Hello.java
=============================================
package test;
public class Hello
{
  static
  {
    try
    {
      //´Ë´¦¼´Îª±¾µØ·½·¨ËùÔÚÁ´½Ó¿âÃû
&n ......