http://blog.csdn.net/haidage/article/details/6794529
logback Common Configuration (ii) <appender>
">
<appender>:
<appender> is the child node of <configuration>, the component responsible for writing the log.
<appender> has two required attribute name and class. Name Specifies the Appender name, and class specifies the fully qualified name of the Appender.
1.ConsoleAppender:
Add the log to the console with the following child nodes:
<ENCODER>: Format the log. (Specific parameters will be explained later)
<target>: String System.out or System.err, default System.out;
For example: XML code<Configuration> <AppenderName= "STDOUT" class= "Ch.qos.logback.core.ConsoleAppender"><Encoder>< Pattern>%-4relative [%thread]%-5level%logger{35}-%msg%n</ Pattern></Encoder></Appender><RootLevel= "DEBUG"><Appender-refref= "STDOUT"/></Root></Configuration>
2.FileAppender:
Add the log to the file with the following child nodes:
<file>: The file name that is written, can be a relative directory, or it can be an absolute directory, and will be created automatically if the parent directory does not exist, and there is no default value.
<append>: If true, the log is appended to the end of the file, and if it is false, empty the existing file, the default is true.
<ENCODER>: Format the logged events. (Specific parameters will be explained later)
<prudent>: If true, the log is securely written to the file, even though other fileappender are also writing to the file, inefficient and false by default.
For example: XML code<Configuration><AppenderName= "FILE" class= "Ch.qos.logback.core.FileAppender"><file>TestFile.log</file> <Append>True</Append><Encoder>< Pattern>%-4relative [%thread]%-5level%logger{35}-%msg%n</ Pattern></Encoder></Appender><RootLevel= "DEBUG"><Appender-refref= "FILE"/></Root></Configuration>
3.RollingFileAppender:
Scrolls the record file, logs the log to the specified file, and records the log to other files when a condition is met. Has the following child nodes:
<file>: The file name that is written, can be a relative directory, or it can be an absolute directory, and will be created automatically if the parent directory does not exist, and there is no default value.
<append>: If true, the log is appended to the end of the file, and if it is false, empty the existing file, the default is true.
<ENCODER>: Format the logged events. (Specific parameters will be explained later)
<rollingpolicy>: When scrolling occurs, the behavior of the Rollingfileappender is determined, involving file movement and renaming.
<triggeringpolicy : tell rollingfileappender appropriate activation scrolling.