1

I have migrated from JBoss 4.2.3 to JBoss AS 6. On the JBoss 4.2.3 I had configured log4j to output some logs in different files using log4j.properties. The current logging (on JBoss AS 6) doesn't output anything but the default server.log and boot.log. Please help me find why I don't get the other logs.

Here is my project structure:

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

I added the jboss-deployment-structure.xml after the migration due to reading I found on that issue. Unfortunately this doesn't worked for me. Here are the configurations:

jboss-deployment-structure.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

The time logger is my custom logger that is why it has a bit different configuration.

P.S. And please don't tell me that my mistake is that I am using version 6 of JBoss.

nyxz
  • 6,918
  • 9
  • 54
  • 67
  • See the answer mentioned here. You have to add the log4j as a module http://stackoverflow.com/questions/9584787/using-log4j-with-jboss-7-1 – Joe2013 Mar 11 '13 at 11:23
  • In this answer you are not adding the log4j as a module but excluding it from load queue from the server(as I see it) so the default config will not be loaded. As you can see I've added the jboss-deployment-structure.xml content in my question. In there I have mentioned the module log4j and this didn't work for me. – nyxz Mar 11 '13 at 11:47
  • Unless I am missing something, log4j should be configured in the /deploy/jboss-logging.xml file, as per http://stackoverflow.com/questions/6382224/where-do-you-configure-log4j-settings-in-jboss6 – DaveB Mar 21 '13 at 18:13

0 Answers0