Before writing a Web project with the spring framework, the Logback.xml file configured under the Resources directory is as follows:
<configuration>
<appender name= "Jeeout" class= "Ch.qos.logback.core.ConsoleAppender" >
<!--Encoders is assigned the type Ch.qos.logback.classic.encoder.PatternLayoutEncoder
By default--
<encoder>
<pattern>%d{yyyy-mm-dd HH:MM:SS} [%thread]%-5level%logger{36}-
%msg%n</pattern>
</encoder>
</appender>
<appender name= "Javaout" class= "Ch.qos.logback.core.ConsoleAppender" >
<!--Encoders is assigned the type Ch.qos.logback.classic.encoder.PatternLayoutEncoder
By default--
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
<appender name= "Rollingappender"
class= "Ch.qos.logback.core.rolling.RollingFileAppender" >
<rollingpolicy class= "Ch.qos.logback.core.rolling.TimeBasedRollingPolicy" >
<filenamepattern>, .... /.. /java_logs/heuristic-%d{yyyy-mm-dd}.log
</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder><!--must be specified, otherwise it will not output content to the file-
<pattern>%d{hh:mm:ss. SSS} [%thread]%-5level%logger{5}-%msg%n
</pattern>
</encoder>
<append>false</append>
<prudent>false</prudent>
</appender>
<!--<logger name= "Com.thinkland.serv.NccBarcodeServlet" level= "DEBUG" additivity= "false" >
<appender-ref ref= "Jeeout"/> </logger> <logger name= "Com.thinkland.ncc.util.AesUtil"
Level= "Info" additivity= "false" > <appender-ref ref= "javaout"/> </logger>--
<root level= "Debug" >
<appender-ref ref= "Rollingappender"/>
</root>
</configuration>
My e: Below can find the Java_logs file, in which you can see the output of the log information
But now with the servlet written Web project, is still MAVEN project, also placed under the resources directory, but under the E-disk can not find the output log, and the Logback.xml file deleted, the console output log information;
I'm adding a place in the output log
File File=new file (".");
System.out.println (File.getabsolutepath ());
Found not under Tomcat.
But in:
F:\weiWorkspace\qq\.
So go to the F-disk search, unexpectedly found in this place has output log, so in logback.xml configured to absolute path
Under absolute path is the file where the log output can be found
The difference between servlet and spring frameworks using Logback.xml