warn-启动时log4j报错,log4j应该怎么配置

问题描述

启动时log4j报错,log4j应该怎么配置
<appender name="avatarAppender" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="/data/applogs/tpfun-dealDuplicateCheck-job/logs/avatar.log" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="[tpfun-dealDuplicateCheck-job]%d %-5p [%c] %m%n" />
    </layout>
</appender>

<appender name="appAppender" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="/data/applogs/tpfun-dealDuplicateCheck-job/logs/app.log" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="[tpfun-dealDuplicateCheck-job]%d %-5p [%c] %m%n" />
    </layout>
</appender>

<appender name="ibatisAppender" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="/data/applogs/tpfun-dealDuplicateCheck-job/logs/ibatis.log" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="[tpfun-dealDuplicateCheck-job]%d %-5p [%c] %m%n" />
    </layout>
</appender>

<logger name="com.dianping.avatar" additivity="false">
    <appender-ref ref="CONSOLE" />
    <appender-ref ref="avatarAppender" />
</logger>

<logger name="com.ibatis" additivity="false">
    <level value="WARN" />
    <appender-ref ref="ibatisAppender" />
</logger>

<logger name="java.sql">
    <level value="WARN" />
</logger>

<logger name="org.springframework.jms">
    <level value="ERROR" />
</logger>

<logger name="org.springframework.context">
    <level value="INFO" />
    <appender-ref ref="CONSOLE" />
    <appender-ref ref="appAppender" />
</logger>

<root>
    <level value="INFO" />
    <appender-ref ref="CONSOLE" />
    <appender-ref ref="appAppender" />
</root>

这是我的配置文件,报错为
log4j:WARN Fatal parsing error 2 and column 72
log4j:WARN 在 publicId 和 systemId 之间需要有空格。
log4j:ERROR Could not parse url [file:/D:/workspace/tpfun-job/tpfun-dealDuplicateCheck-job/target/classes/log4j.xml].
org.xml.sax.SAXParseException; systemId: file:/D:/workspace/tpfun-job/tpfun-dealDuplicateCheck-job/target/classes/log4j.xml; lineNumber: 2; columnNumber: 72; 在 publicId 和 systemId 之间需要有空格。
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:612)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:711)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:618)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:470)
at org.apache.log4j.LogManager.(LogManager.java:122)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:64)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:253)
at com.dianping.avatar.log.slf4j.Slf4jLogger.(Slf4jLogger.java:38)
at com.dianping.avatar.log.slf4j.Slf4jLoggerBuilder.buildLogger(Slf4jLoggerBuilder.java:60)
at com.dianping.avatar.log.AvatarLoggerFactory.getLogger(AvatarLoggerFactory.java:90)
at com.dianping.tpfun.job.dealDuplicateCheck.App.(App.java:11)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116)
log4j:WARN No appenders could be found for logger (com.dianping.tpfun.job.dealDuplicate.App).
log4j:WARN Please initialize the log4j system properly.

解决方案

你贴的这个配置文件 没有publicId 和 systemId ,怎么就报log4j:WARN 在 publicId 和 systemId 之间需要有空格,让人怎么解决

时间: 2024-09-14 15:07:19

warn-启动时log4j报错,log4j应该怎么配置的相关文章

ssh-项目启动时c3p0报错 求大神

问题描述 项目启动时c3p0报错 求大神 com.mchange.v2.async.ThreadPoolAsynchronousRunner]com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@179d578 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! [com.mchange.v2.async.T

启动时硬盘报错

  故障问题:电脑开机时报错,提示信息为"DISK BOOT FAILURE, INSERT SYSTEM DISK AND PRESS ENTER",换了硬盘数据线也不行, 将硬盘换到别人的主机上却一切正常. 故障处理:单从错误信息来看,是提示找不到引导信息.在开机时按DEL键进入BIOS,在BIOS里面进入"Advanced BIOS Features"菜单,看看"First Boot"选项是不是显示为光盘(CDROM)启动,如果是,改为硬盘

我的Tomcat单独启动时正常,可是在Eclipse中启动时就报错,是什么原因?

问题描述 Eclipse中错误信息是:2011-4-18 11:42:09 org.apache.catalina.core.AprLifecycleListener init信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:Javajdk1.6.0_

求助!tomcat启动正常,访问javaweb时控制台报错

问题描述 求助!tomcat启动正常,访问javaweb时控制台报错 访问javaweb项目时报错,在myeclise6.0上无该异常,在myeclise10上报如下异常:org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet jsp threw exceptionjavax.xml.parsers.FactoryConfigurationError: Provider org.a

ssh整合-spring整合hibernate做测试时没有报错,当三个整合时启动就报错啦,求大神指点!!

问题描述 spring整合hibernate做测试时没有报错,当三个整合时启动就报错啦,求大神指点!! 报的错误org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'ecsUnsigned' on target class [class $Proxy17] failed; nested exception is org.springframework.tran

项目移到linux环境下时tomcat报错 java.util.zip.ZipException: invalid END header

问题描述 我把我的一个windows环境下的项目移到linux环境下时tomcat报错,报错如下:java.util.zip.ZipException: invalid END header (bad central directory offset)at java.util.zip.ZipFile.open(Native Method)at java.util.zip.ZipFile.<init>(ZipFile.java:114)at java.util.jar.JarFile.<i

项目启动问题-web项目启动成功没有报错 但是访问就404

问题描述 web项目启动成功没有报错 但是访问就404 web项目启动成功没有报错 五月 26, 2014 11:15:27 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ssm' did no

spring和mybatis集成时总报错 麻烦帮忙看下什么原因

问题描述 spring和mybatis集成时总报错 麻烦帮忙看下什么原因 项目请求数据的时候报Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.business.dao.system.AdminMapper.selectByPrimaryKey麻烦大神帮忙看下这是啥原因,找了好久不知道

android-Android程序在有些手机上可以运行有些手机打开时就报错

问题描述 Android程序在有些手机上可以运行有些手机打开时就报错 有些人说是手机系统版本的问题,我的版本设置为 android:minSdkVersion=""8"" android:targetSdkVersion=""19"" />错误为:03-27 17:42:49.851: D/jdwp(18655): sendBufferedRequest : len=0x3303-27 17:42:50.544: D/d