How can I log with Log4J SOAP request and response in AXIS 1.x?

前端 未结 6 1669
轮回少年
轮回少年 2020-12-13 21:20

I am having the next problem:

I want to log the SOAP requests/responses that land on my web service (server side). Trying to configure my web service in the wsdd fil

6条回答
  •  猫巷女王i
    2020-12-13 21:52

    I know its a old thread, but may be useful for people looking for answers.

    For AXIS-1 Server side logging, update your server-config.wsdd like below. server-config.wsdd is under WEB-INF folder of your war file.

    A new handler for log. The file name along with path is configurable.

    
      
    
    

    You can also use the LogHandler.writeToConsole parameter with the value as "true" to log in your console log.

    Then update the section to have

    
              
    
     
     
    
    

    If the requestFlow and responseFlow contains other handlers ,put the log as the first handler.

    This should be only used for debugging purpose not for production. Since the logging is naive and do the normal write operation on the file without any buffer. Secondly, the log file will grow to GB's since there is no rollover mechanism.

    For AXIS-1 Client Side logging, update your client-config.wsdd like below. The client-config.wsdd should go into your classpath directly under a root folder configured in the classpath not in any sub-folders. The best location is the same directory where your log4j.xml or log4j.properties file is present(Thanks to #MukeshKoshyM post above).

        
    
        
         
        
    
        
          
            
         
         
            
         
        
    
    
    
    

    The same issue mentioned for server side logging is applicable for client side as well.

    For production, write your own log handler by extending org.apache.axis.handlers.BasicHandler and configure the class file in the handler. Please look the above answer from #raspayu to configure your own. To log the faults override the public void onFault(MessageContext msgContext) method in your Handler.

提交回复
热议问题