The difference between servlet and spring frameworks using Logback.xml

Source: Internet
Author: User

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&gt, .... /.. /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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.