7 Replies Latest reply on Mar 13, 2009 6:33 PM by mawa

    Access server.log with JBoss5

    mawa

      Hello.

      I want to display the content of the server.log within my own web application. With JBoss 4.2.3 I added a new context to the server.xml of the tomcat, so I could access the log file by the URL '/logfiles/server.log'.

      <Context path="/logfiles" docBase="log" debug="0" reloadable="true"/>
      


      With JBoss 5 this is no longer possible as I get an exception:

      ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=WebServer state=Create
      org.jboss.xb.binding.JBossXBException: Failed to parse source: Context not found as a child of Host
      


      Is there another more smarter way to have access to the content of the logfiles?

        • 1. Re: Access server.log with JBoss5
          jaikiran

           

          org.jboss.xb.binding.JBossXBException: Failed to parse source: Context not found as a child of Host


          See this http://www.jboss.org/index.html?module=bb&op=viewtopic&t=150966

          • 2. Re: Access server.log with JBoss5
            mawa

            Thanks for your answer, but I read it already. The suggestion is to put static content into war-files and deploy them, ok. I didn't find any hint, how to access the log/server.log with JBoss5.

            • 3. Re: Access server.log with JBoss5
              peterj

              Here's a bizarre idea. Set the jboss.server.log.dir system property to use a .war extension and then follow the advice in the above jira. To set the system property, add something like "-Djboss.server.log.dir=/path/to/server/xxx/log.war" to JAVA_OPTS within run.conf (Linux) or run.bat (Windows).

              • 4. Re: Access server.log with JBoss5
                peterj

                Slight revision - I think you will also need to move the log directory out of server/xxx because if you leave it there then the deploy directory could be scanned twice. So I suggest something like: "-Djboss.server.log.dir=/opt/jboss/log.war" then add "/opt/jboss" as another deploy directory.

                • 5. Re: Access server.log with JBoss5
                  mawa

                  Peter, isn't it true that deploy directories are scanned for changes continually jboss is running. I'm afraid to put log files in such a deploy directory, so jboss is notified about each modification. Is this a problem ?

                  • 6. Re: Access server.log with JBoss5
                    peterj

                    Yes, the deploy directory is scanned periodically, but for an exploded war directory (which is what you will have), it only looks at the WEB-INF/web.xml file, which in your case will never change. So the fact that the log file is changing constantly should not be an issue.

                    • 7. Re: Access server.log with JBoss5
                      mawa

                      I used the existing log directory and created a new log.war directory in it. Then I added the log directory to the applicationURIs and put web.xml and jboss-web.xml into log.war/WEB-INF. At last, following your suggestion, I set the -Djboss.server.log.dir to the log.war in run.bat.

                      It works very fine, doing what I wanted to do. Thanks a lot.