2 Replies Latest reply on Jan 12, 2004 1:48 PM by manibhat

    log4j separate log files

    mprivat

      Hi all,

      I have two EAR files, each declaring their own log4j xml config. They have a different classloader namespace (using jboss-app.xml). They are both supposed to log to a different file, but everything is logged into the first webapp's file. I am assuming this is because log4j is actually loaded by the server (because it's in its classpath).

      The question is: Is there a way to separate these log files so that each webapp can log into its own file?

      Any help appreciated!
      Michael

        • 1. Re: log4j separate log files

          Add two separate appenders to your log config, and config different categories for each appender.

          • 2. Re: log4j separate log files

             

            "manibhat" wrote:
            I am also facing similar kind of problem.

            Detail:
            In a windows environment I bring up the JBoss server using run.bat and the lof are generated in .../default/log/boot.log and so on.
            I also execute another batch file run2.bat and it also generates boot.log but in the root directory (eg C:/log/boot.log). I assume the value of {jboss.server.home.dir} in the log4j.properties in run.jar is read as "".

            I added

            log4j.appender.FILE1=org.jboss.logging.appender.FileAppender
            log4j.appender.FILE1.File1=/log2/boot.log
            log4j.appender.FILE1.layout=org.apache.log4j.PatternLayout
            log4j.appender.FILE1.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
            log4j.appender.FILE1.Append=false

            in the log4j.properties.

            I also added appropriate tags in the log4j.xml.

            Question
            How do I set the value of {jboss.server.home.dir} again when I execute run2.bat ?

            When I execute run2.bat how do I make JBoss look for the value "log4j.appender.FILE1.File1" instead of log4j.appender.FILE.File.
            so that it puts the boot.log in the right directory.

            Thanks
            manibhat