Struts2 ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging

INFO [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

原因:log4j2的配置文件没有导入

尝试导入log4j.properties ,但并不行

需要导入log4j2.xml

下面给出示范:

Struts2 ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging_第1张图片

然后直接导入你项目的src,eclipse和IDEA均会把其配置到WEB-INF的classes下

下面是我的log4j2的配置


<Configuration>
    <Appenders>
        <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
        Console>
        <RollingFile name="RollingFile" fileName="logs/strutslog1.log"
                     filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
            <PatternLayout>
                <Pattern>%d{MM-dd-yyyy} %p %c{1.} [%t] -%M-%L- %m%nPattern>
            PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="1 KB"/>
            Policies>
            <DefaultRolloverStrategy fileIndex="max" max="2"/>
        RollingFile>
    Appenders>
    <Loggers>
        <Logger name="com.opensymphony.xwork2" level="WAN"/>
        <Logger name="org.apache.struts2" level="WAN"/>
        <Root level="warn">
            <AppenderRef ref="STDOUT"/>
        Root>
    Loggers>

Configuration>

如果要指定生成日志文件,可以参考以下

图2

然后其生成在:

Struts2 ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging_第2张图片

你可能感兴趣的:(struts2.0,【Struts2】)