1

我已经从迁移JBoss 4.2.3JBoss AS 6. 在JBoss 4.2.3我已配置log4j为使用log4j.properties. 当前的日志记录(在 JBoss AS 6 上)除了默认server.logboot.log. 请帮我找出为什么我没有得到其他日志。

这是我的项目结构:

/src
 `--log4j.properties
/META-INF
 `--jboss-deployment-structure.xml
/lib (added to classpath)
 `--log4j.jar

jboss-deployment-structure.xml由于阅读了我在该问题上发现的内容,我添加了迁移后的内容。不幸的是,这对我不起作用。以下是配置:

jboss-部署-结构.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.apache.log4j" />
            <module name="org.jboss.logging" />
            <module name="org.jboss.logmanager" />
            <module name="org.jboss.log4j.logmanager" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>  

log4j.properties

# Set root category priority to INFO and its only appender to CONSOLE.
log4j.rootCategory=DEBUG, CONSOLE, LOGFILE

# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
#log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE

# Categories
log4j.category.org.hibernate=INFO
log4j.category.org.hibernate.SQL=DEBUG

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%F->%M() line%L] %d{dd-MM-yyyy HH:MM:ss} - %m%n
log4j.appender.CONSOLE.Encoding=ISO-8859-1

# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.Append=false
log4j.appender.LOGFILE.File=${jboss.server.home.dir}/log/cache.log
log4j.appender.LOGFILE.Threshold=DEBUG
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
log4j.appender.LOGFILE.Encoding=ISO-8859-1

# AspectJ time logger
log4j.logger.TimeLog=DEBUG, timeLog, CONSOLE
log4j.additivity.TimeLog=false

log4j.appender.timeLog=org.apache.log4j.FileAppender
log4j.appender.timeLog.File=${jboss.server.home.dir}/log/time.log
log4j.appender.timeLog.Threshold=DEBUG
log4j.appender.timeLog.layout=org.apache.log4j.PatternLayout
log4j.appender.timeLog.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss} %c %m%n
log4j.appender.timeLog.Encoding=ISO-8859-1

时间记录器是我的自定义记录器,这就是为什么它有一点不同的配置。

PS请不要告诉我我的错误是我使用的是 JBoss 6 版。

4

0 回答 0