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

    log4j separate log files

    mprivat Newbie

      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!

        • 1. Re: log4j separate log files
          Juha Lindfors Master

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

          • 2. Re: log4j separate log files
            Manish Bhatia Newbie


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

            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.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n

            in the log4j.properties.

            I also added appropriate tags in the log4j.xml.

            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.