5 Replies Latest reply on Jan 16, 2013 12:12 PM by sanssan

    access-log configuration doesn't allow relative-to path configuration

    rsinghal

      I am trying to configure access logs location to out side of JBoss Home on JBoss 7.1.2. I tried with various values in reletive-to attribute but nothing seems to work. One of the tried configuration is as follows:

       

      <virtual-server name="default-host" enable-welcome-root="true">

                      <alias name="localhost"/>

                      <alias name="example.com"/>

                      <access-log pattern="Time Taken: %T %h %l %u %t %r %s %b" rotate="true">

                                         <directory path="access-log" relative-to="C:\test-logs"/>

                       </access-log>

      </virtual-server>

       

      I am getting following error:

       

      05:09:43,287 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.web.host.default-host: org.jboss.msc.service.StartException in service jboss.web.host.default-host: Failed to start service

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_02]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_02]

                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]

      Caused by: java.lang.IllegalArgumentException: JBAS014847: Could not find a path called 'access-log'

                at org.jboss.as.controller.services.path.PathManagerService.resolveRelativePathEntry(PathManagerService.java:88)

                at org.jboss.as.web.WebVirtualHostService.start(WebVirtualHostService.java:84)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                ... 3 more

        • 1. Re: access-log configuration doesn't allow relative-to path configuration
          jaysensharma

          HI Ravi,

           

              You should define the <paths> first in your configuration file then only you can use the relative to ....

           

          Example:

          ==========

           

          <paths> 
              <path name="access-log-dir" path="C:/test-logs" />
          </paths>
          
          

           

           

          Then try :

          ==========

           

          <virtual-server name="default-host" enable-welcome-root="true">
                          <alias name="localhost"/>
                          <alias name="example.com"/>
                          <access-log pattern="Time Taken: %T %h %l %u %t %r %s %b" rotate="true">
                                             <directory path="access-log" relative-to="access-log-dir"/>
                           </access-log>
          </virtual-server>
          

           

          A logical name for a filesystem path. The domain.xml, host.xml and standalone.xml configurations all include a section where paths can be declared. Other sections of the configuration can then reference those paths by their logical name, rather than having to include the full details of the path (which may vary on different machines).


           

          To Know more about <path> element please refer to the following link:

          https://docs.jboss.org/author/display/AS7/General+configuration+concepts

          • 2. Re: access-log configuration doesn't allow relative-to path configuration
            rsinghal

            Thanks Jay, it worked. Now, I want to pass access log location through system property -DACCESS_LOG_LOCATION="C:/test-logs". I am using below entry but it's not resolving ACCESS_LOG_LOCATION:

             

            <paths> <path name="access-log-dir" path="${ACCESS_LOG_LOCATION}" /> </paths>
            • 3. Re: access-log configuration doesn't allow relative-to path configuration
              jaysensharma

              Hi Ravi,

               

                    There are some property substitution related issues which are fixed in JBoss AS7.2  so you will need to try the same test on the Nightly build (latest build) of JBoss AS7, the property substitution will definitely work there.

              • 4. Re: access-log configuration doesn't allow relative-to path configuration
                rsinghal

                I am using last nighlty build which was available i.e. 9th May build . I may need to build it from the 7.1.2 tag if it's fixed there. Many thanks for your help.

                • 5. Re: access-log configuration doesn't allow relative-to path configuration
                  sanssan

                  Thanks Jay.

                   

                  It worked good with me. I do have 1 query addition to this...

                  <server xmlns="urn:jboss:domain:1.2">
                       <extensions>
                            ...............
                      </extensions>
                  
                      <system-properties>
                          <property name="myapp.config.file.path" value="app"/>
                      </system-properties>
                  
                      <paths>
                          <path name="myapp.applog" path="app" relative-to="jboss.server.log.dir"/>
                      </paths>
                       ...............
                  </server>
                  

                   

                   

                  I can access System property like below on my Java class

                   

                  System.getProperty("myapp.config.file.path");
                  

                   

                  But,

                   

                  System.getProperty("myapp.applog");
                  

                   

                  returning null.