3 Replies Latest reply on Aug 13, 2012 2:48 PM by jamezp

    how to get hold of JBoss logger configuration from an application

    frank_luo

      I configured log files as Rotating File Handlers, and we need read old log files back for further processing, hence there is a need to know the file's locatoin/path/name/postfix etc.

       

      So I'd like to know if there is a way to get hold of the logger's configuration, otherwise I have to hard-code it somewhere then the files couldn't be found if file name changed throught Admin console.

        • 1. Re: how to get hold of JBoss logger configuration from an application
          jamezp

          I'm not sure I fully understand what you're after, but if you want the log directory it looks like it's stored in a system property.

           

          final String logDir = System.getProperty("jboss.server.log.dir");
          

           

          --

          James R. Perkins

          1 of 1 people found this helpful
          • 2. Re: how to get hold of JBoss logger configuration from an application
            frank_luo

            Thank James for quick reply.

             

            My company has a hard rule to log everything to /var/log/ directory, so I have to use the following to re-direct the logger to the directory.

             

            <paths>
                <path name="my.log.dir" path="/var/log/jboss"/>
            </paths>

             

            and

                      

            <periodic-rotating-file-handler ...>

            <file relative-to="my.log.dir" path="my.log"/>

             

            So the technique you illustrated here won't work.

             

            Is there a way to get around this? Or it will also be great if you know how to customize "jboss.server.log.dir".

            • 3. Re: how to get hold of JBoss logger configuration from an application
              jamezp

              Frank,

              You can definitely override the servers log directory if you want all logs to go to a different location. To test it just pass -Djboss.server.log.dir=/var/log/jboss. If that works, then you could just add that to the JAVA_OPTS on the standalone.conf.

               

              --

              James R. Perkins