1 2 Previous Next 17 Replies Latest reply: Nov 10, 2010 12:58 PM by Erick Jeronimo Diaz RSS

    WebServices logging

    krishnaroopa Senthilkumar Newbie

      We are using JBOSS 4.2.2 GA. We expose all our services as WEB
      Services and our client application inturn consumes them.
      Now, we need to log the Request and response objects for the web
      service calls. CAn we do it using log4j logging available in JBOSS.

      Searching the forums and articles, found that we can have a separate
      appender. But what package we have to refer, for web service calls? It
      must be some JBOSS package where the web service is first taken in for
      processing?

        • 2. Re: WebServices logging
          krishnaroopa Senthilkumar Newbie



          It Works.. Thanks a lot..

          I had been beating the bush around for the past 5 days...
          You saved my work

          Thanks again for your instant reply.

          regards
          KRS

          • 3. Re: WebServices logging
            krishnaroopa Senthilkumar Newbie

            Hi

            Now all webservices are logged to a file as xml. We need to log in a MySQL database. I used JDBCAppender and the configuration is as shown






            <param name="sql" value="insert into logTable (message, class, priority, log_date)
            values ('%m', '%c', '%p', '%d{dd.MM.yyyy}')"/>



            <appender-ref ref="JDBC"></appender-ref>



            But in the database, i get only debug and info, not the Traces from MessageTrace class
            Why?

            regards
            KRS

            • 4. Re: WebServices logging
              Peter Johnson Master

              Try adding

              <priority value="TRACE"/>


              to the category.

              P.S. When posting XML text or source code, please enclose the text in UBBCode "code" tags - you can do this by selecting the text and clicking the Code button above the editor window. Also, click the Preview button to ensure that the formatting is correct and the XML text shows up before posting.


              • 5. Re: WebServices logging
                krishnaroopa Senthilkumar Newbie

                I have already given that

                <!-- ====================================================================================-->
                <!-- All Web Service Trace logged directly to MySQL Database, through JDBC Appender -->
                <!-- ====================================================================================-->

                <appender name="JDBC" class="org.apache.log4j.jdbc.JDBCAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="Driver" value="com.mysql.jdbc.Driver"/>
                 <param name="URL" value="jdbc:mysql://127.0.0.1:3306/logdb" />
                 <param name="user" value="root" />
                 <param name="password" value="root" />
                 <param name="sql" value="insert into logTable (message, class, priority, log_date)
                 values ('%m', '%c', '%p', '%d{dd.MM.yyyy}')"/>
                </appender>
                
                <category name="org.jboss.ws.core.MessageTrace">
                 <appender-ref ref="JDBC"></appender-ref>
                 <priority value="TRACE"/>
                 </category>


                The same category works if it is for a file appender
                Pls help


                • 6. Re: WebServices logging
                  krishnaroopa Senthilkumar Newbie

                  Hi all

                  Now that we could not log to database directly. We did the following work around.
                  Wrote the log events as xml elements, using XMLLayout and then watch the log file.
                  Whenever, the log file changed, the application starts and log are inserted into db

                  Next issue we are facing is there is no link between the request and response.
                  Is there any means to identify the response for particular request?

                  or can be extend JBOSS web Trace class?

                  regards
                  KRS

                  • 7. Re: WebServices logging
                    Richard Opalka Master

                     

                    "mobaxkrs" wrote:
                    Next issue we are facing is there is no link between the request and response.
                    Is there any means to identify the response for particular request?

                    I'd suggest to use our Records Management Framework.

                    • 8. Re: WebServices logging
                      Richard Opalka Master

                      Another option you have is to use WS-Addressing in your web services and use
                      MessageID correlation identifier to identify which response belongs to which request. Then you could identify related messages using your log4j integration work you already did ;)

                      • 9. Re: WebServices logging
                        krishnaroopa Senthilkumar Newbie

                        How to enable recording - which file has the configuration

                        • 10. Re: WebServices logging
                          Richard Opalka Master

                          Read Records Management Framework documentation above, please.

                          • 11. Re: WebServices logging
                            krishnaroopa Senthilkumar Newbie

                            Hi

                            I read through the Records management framework documentation. But i Could not figure out how to achieve it.. The implementation portion in the document is not clear.

                            Somehow i figured out
                            /home/krs/mobicents-all-1.2.0.BETA3-jboss-4.2.2.GA/jboss-4.2.2.GA/server/default/deploy/jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml and added the bean properties for the recorders.
                            Don't know it is what we need to do.

                            Where will the logged information available.. How to get that.. Could u specify implementation specific details.. or point to any other links

                            • 12. Re: WebServices logging
                              krishnaroopa Senthilkumar Newbie

                              Also i found that the default standard endpoint config at
                              jboss-4.2.2.GA/server/default/deploy/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml has no <pre-handler-chains> Element in it

                              The config is

                              <endpoint-config>
                               <config-name>Standard Endpoint</config-name>
                               </endpoint-config>


                              • 13. Re: WebServices logging
                                Alessio Soldano Master

                                The documentation clearly says the Record Management is available starting from version 2.0.3. Which version of JBossWS are you using? The version that comes with JBoss 4.2.2.GA is 2.0.1.SP2, thus if you did not change anything about that, you would simply need to upgrade to a more recent version. In that case, take a look at the supported target containers matrix : http://jbossws.jboss.org/mediawiki/index.php?title=Supported_Target_Containers

                                This said, for a simple use of the Record Management with Native stack you don't need to do anything special besides going to the JMX console and activate the recording flag in the already installed LogRecorder instance for you endpoint. No implementation required, no changes to the endpoint config required (assuming you're using one of the provided endpoint configuration). The LogRecorder will simply log every message going through your endpoint into your server.log.
                                Further customization and usescases are explained in the documentation, I'm sure you'll understand everything easily once you have that stuff (i.e. you using a jbossws version that has that). Also consider taking a look at the testcases in the sources, package org.jboss.test.ws.management.recording.

                                • 14. Re: WebServices logging
                                  krishnaroopa Senthilkumar Newbie

                                  Hi all

                                  Thanks for the reply and your time,

                                  Now, I have moved to jboss 4.2.3 GA. I could find the record processors installed. I enabled recording for both log recorder and memory buffer recorder.

                                  In the web service endpoint, I provided the config

                                  @WebService()
                                  @EndpointConfig(configName = "Standard Endpoint")
                                  @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
                                  


                                  I had enabled web service trace too, in the jboss_log4j.xml

                                  But could not find any recording in server.log :-(

                                  regards
                                  KRS

                                  1 2 Previous Next