[Hibernate framework development 3] Build the hibernate log (slf4j to log4j) environment and build the JUnit unit test environment!

Source: Internet
Author: User

All articles on this site areLi huaming himiOriginal, reprinted must be explicitly noted:
Reprinted from[Heimi gamedev block]Link: http://www.himigame.com/hibernate/806.html

☞Click to subscribe☜
The latest developments in this blog! Notify you of the latest blog in time!

Since the parsing and framework of the latest cocos2dx action editor was not updated, we will continue to learn about hibernate from today. Next we will explain in the second article, copy, in the second article, change the name of the first annotation project to "logforhibernate ";

First, build the log4j environment;

Step 1: The user libraries we set before will continue to add the configuration related to printing logs (PS. in fact, the log console printing is crucial for our Dev. On the one hand, we can understand the current running status and find the source of the bug in real time ~, On the other hand, log4j logs can be used for us). Add the following jar package to myhibernate of himi (Custom User libraries ):

First, himi myhibernate Delete the slf4-nop-1.5.8.jar package, and then replace it with the implementation of log4j the first jar package as follows:

First jar package/apache-log4j-1.2.15/log4j-1.2.15.jar

Continue adding the second jar package/slf4j-1.5.8/slf4j-1.5.8/slf4j-log4j12-1.5.8.jar

(This slf4j-log4j12-1.5.8.jar is actually converting slf4j into the "adapter" of log4j logs ";)

Next, we need to configure the log4j configuration file. The default configuration file name is "log4j. properties"

You do not need to create it manually. You can obtain it directly in the following path:

/Hibernate-distribution-3.3.2.GA/project/etc/log4j. Properties

Copy to the project. cfg. XML "placed in the same level of directory, OK, directly run the project observation console, you will find a lot of debug information, some of which we cannot use first, OK, open log4j. the properties configuration file is changed to the following:

12345678910111213141516171819202122232425

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.