Mybatis import log4j, plus export of resources to solve the problem IDEA

The basic steps Mybatis log4j configuration is as follows:
1 :, introduced depends Log4j

<!-- log4j依赖 -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

2, is introduced in Log4j Mybatis-config.xml file

<settings>
        <setting name="logImpl" value="LOG4J"/>
    </settings>

3, create a log4j.properties file and write log4j settings in this file

log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

This configuration in the project completed the log4j log. (Log4j simply provided detailed self Baidu)

Here Insert Picture Description

================================================== ====================
IDEA imported resources may occur when creating the project maven problem is xml files and other common file you create will derive there is a resource problem is running time these files are not loaded causing the problem can not find the resources we need to add the item appears in the label pom build file

<build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

This setting can be added later to load the normal resources.

Published 53 original articles · won praise 0 · Views 1964

Guess you like

Origin blog.csdn.net/XXuan_/article/details/104087016