1 Reply Latest reply on Dec 7, 2012 8:58 AM by rob_

    jboss-5.1, changing jboss-log4j.xml on startup (through -D params)

    rob_

      Hi there,

       

      I'm currently working with an (old) jboss-5.1, which I want to read different jboss-log4j.xml files, based on the start script.

      Is there a simple way to tell jboss, that it should use a different jboss-log4j.xml file (for example a jboss-log4f-local.xml, if started by a run.local.bat).

       

      I tried pointing there, using -Dlogging.configuration=file:C:/path/to/alternate/jboss-logf4j-local.xml. Unluckily the server fully ignored

      this property and simply loaded the standard xml file.

       

      Regs

      Rob

        • 1. Re: jboss-5.1, changing jboss-log4j.xml on startup (through -D params)
          rob_

          Found a possible solution to this...

           

          The easiest way seems to be overwriting jboss-service.xml:

           

          <mbean code="org.jboss.logging.Log4jService" name="jboss.system:type=Log4jService,service=Logging" xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">

            <attribute name="ConfigurationURL">${log4j.configuration.XmlFile}</attribute>

             [...]

          </mbean>

           

          While starting the server I could simply add -Dlog4j.configuration.XmlFile=resource:my-personal-log4j.xml and the server fully pulls it in.

           

          Regs,

          Rob