Log4j_slf4j log4j. Properties

Source: Internet
Author: User

The log used by Hibernate is slf4j, and slf4j has various implementation strategies.

Using log4j is one of the methods. Jar package:





The configuration file is placed in the SRC root directory. The configuration file name isLog4j. Properties



Log4j. appender. stdout = org. Apache. log4j. leleappender

Log4j. appender. stdout. Target = system. Out

Log4j. appender. stdout. layout = org. Apache. log4j. patternlayout

Log4j. appender. stdout. layout. conversionpattern = % d {absolute} % 7 P % C: % L-% m % N

Log4j. rootlogger = warn, stdout

Log4j.logger.org. hibernate. SQL = debug

Log4j.logger.org. hibernate. JDBC = info


Usage in the class:

Private Static logger = logger. getlogger (addservlet. Class );


Logger. debug ("debug info ");

Logger.info ("info Info ");

Logger. Warn ("Warning Info ");

Logger. Error ("error Info ");

Logger. Fatal ("Fatal Info ");


Detailed explanation:


Levels are off, fatal, error, warn, info, debug, all in sequence.

Debug <info <warn <error <fatal.



Date and Time



Class Name



Line feed, that is, enter



Specific info



Row number





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.