SLF4J and log4j Use cases

Source: Internet
Author: User

Take the MAVEN project as an example:

Steps:

1. Add dependency to the Maven Pom.xml file:

You will then add 3 jar packages:

2. Add log4j.properties under the project  

3.log4j.properties File Contents

4. Configure in Web. xml:

"classpath:" Representative:/web-inf/classes/

5. Add in the code:

6. The following can be used:

Classpath is the path that represents/web-inf/classes/.

Classpath and classpath* differences:

Classpath: Only look for files in your class path;
Classpath*: Includes not only the class path, but also the jar file (class path) to find

SLF4J and log4j Use cases

Related Article

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.