如何在jboss6中设置log4j.properties的类路径

时间:2012-05-31 08:48:36

标签: java axis2 jboss6.x

您好朋友我在jboss6final中部署了axis2.war,我在axis2.war中遇到了一些问题。

axis2.war目录结构为axis2.war/WEB-INF/classes/log4j.properties,显示war4中存在log4j.properties。

我的问题是如何在Classpath中设置log4j.properties。因为当我尝试在jboss中部署axis2.war时会出现一些错误,如

012-05-30 16:33:53,867 ERROR [STDERR] (http-127.0.0.1-7001-1) log4j:WARN No appenders could be found for logger (com.cdac.AsyncResponseComponent.PrepareSubmitResponse).

2012-05-30 16:33:53,867 ERROR [STDERR] (http-127.0.0.1-7001-1) log4j:WARN Please initialize the log4j system properly.

2012-05-30 16:33:53,868 ERROR [STDERR] (http-127.0.0.1-7001-1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

如果有人有一些宝贵的时间,那么请帮助我谢谢.....

log4j.properties

#

# Licensed to the Apache Software Foundation (ASF) under one

# or more contributor license agreements. See the NOTICE file

# distributed with this work for additional information

# regarding copyright ownership. The ASF licenses this file

# to you under the Apache License, Version 2.0 (the

# "License"); you may not use this file except in compliance

# with the License. You may obtain a copy of the License at

#

# http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing,

# software distributed under the License is distributed on an

# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

# KIND, either express or implied. See the License for the

# specific language governing permissions and limitations

# under the License.

#



# Set root category priority to INFO and its only appender to CONSOLE.

log4j.rootCategory=INFO, CONSOLE

#log4j.rootCategory=INFO, CONSOLE, LOGFILE



# Set the enterprise logger priority to FATAL

log4j.logger.org.apache.axis2.enterprise=FATAL

log4j.logger.de.hunsicker.jalopy.io=FATAL

log4j.logger.httpclient.wire.header=FATAL

log4j.logger.org.apache.commons.httpclient=FATAL



# CONSOLE is set to be a ConsoleAppender using a PatternLayout.

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout

log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %m%n



# LOGFILE is set to be a File appender using a PatternLayout.

log4j.appender.LOGFILE=org.apache.log4j.FileAppender

log4j.appender.LOGFILE.File=axis2.log

log4j.appender.LOGFILE.Append=true

log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout

log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

1 个答案:

答案 0 :(得分:0)

无需在Classpath中专门设置log4j.properties。只需将属性文件放在项目的根级别,就会自动将其添加到项目的类路径中。