6 Replies Latest reply on Jan 5, 2004 1:53 PM by Sri

    Cature JBoss Log Output?

    nivek Newbie

       

      "nevik" wrote:
      "nevik" wrote:
      What would be the steps needed to cature logging output
      from Jboss to say a fat client's JTextPane?
      As an example,I would like to capture the output being sent to server.log but have it displayed in a mangement console instead. Very similar to Eclipse plugin for Jboss where console output is rendered for JBoss startup and deployments. I do not want to use FileInputStream to read the contents of the log files, but have it rendered dynamically possibly through JMX/RMI connector to JBoss.


        • 1. Re: Cature JBoss Log Output?
          Dag Liodden Newbie

           

          "DaGGeRRz" wrote:
          "DaGGeRRz" wrote:
          Configure a Log4J SocketAppender. This is implemented in a new Management / Monitoring application called Panoptes Management Console which I've just started. Check out the cvs sources for a sample log4j configuration and a sample implementation of a socketlistener.


          • 2. Re: Cature JBoss Log Output?
            Dag Liodden Newbie

             

            "DaGGeRRz" wrote:
            "DaGGeRRz" wrote:
            And the url is http://sourceforge.net/projects/panoptesmgmt/
            :)


            • 3. Re: Cature JBoss Log Output?
              nivek Newbie

               

              "nevik" wrote:
              "nevik" wrote:
              So essentially you are adding an appender to a particular JBoss instance and pushing the log messages out to a remote host where the log events can be handled. So, if you were dealing with multiple instances of JBoss on different servers, you would have to add an appenders to every JBoss instance telling it where to route its messages if you were interested in monitoring that instance.

              How would one tap into a particular JBoss instances LoggingEvents on the fly, w/o adding appenders to each log4j.xml of every instance of JBoss?

              It is highly likely I am missing something, but I am just looking to not have to maintain another resource file everytime a new JBoss is released, telling it where to send its LoggingEvents. I would love to do this dynamically w/o editing config files. Maybe I am just dreaming. :)




              • 4. Re: Cature JBoss Log Output?
                Dag Liodden Newbie

                 

                "DaGGeRRz" wrote:
                "DaGGeRRz" wrote:
                If you really think it's cumbersome to replace your configuration every time a new JBoss version is released (every 6 months or so ;), then the above mentioned solution won't do it. I'm not quite sure how JBoss reads the log4j.xml-files, but I'm pretty certain that you could just supply your own config-file in your war/ear/sar/jar.

                If you want to tap in "on the fly" you'll have to:

                1. Write our own appender (it's like a listener in Swing)
                2. Add this appender to the root-logger of Log4J

                Step 2 can be done via JMX. Get ahold of the Log4J Mbean and call addAppender() (http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/Category.html#addAppender(org.apache.log4j.Appender)). Notice, however, that if you don't want to do logging via sockets, jms or something similar, you'll have to run your client in the same vm as JBoss.

                In the end, deploying your own log4j.xml will probably be the easiest AND best way to do it.


                • 5. Re: Cature JBoss Log Output?
                  nivek Newbie

                   

                  "nevik" wrote:
                  "nevik" wrote:
                  Good advice thanks. Will do some r&d and see if this will be a viable solution.


                  • 6. Re: Cature JBoss Log Output?
                    Sri Newbie

                     

                    "vatsanc" wrote:
                    "vatsanc" wrote:
                    Hello,
                    I am faced with a similar problem. I need to be able to tap into the jboss log messages before they make into server.log. Which Mbean should I access to get hold of the Category to which I can add appenders ?