How to log the time taken by methods in Springframework?

前端 未结 5 1771
时光说笑
时光说笑 2021-01-31 06:20

Is it possible in springframework to log the time taken by methods [ selective | all ] automatically. By automatically i mean, i don\'t want to go to each method and write the l

5条回答
  •  眼角桃花
    2021-01-31 07:19

    Finally i figured out how to do this.

    First of all see the post by 'Pascal Thivent', it did a great help to me. After changing your log4j.properties and creating the timingAdvisor what you have to is, binding this adviser to the class you wan to enable the debugging. You have to change your code like this.

    earlier code:

                      
                
        
    

    New code.

                    
            
    
    
    
        
        
            com.xyz.sc.db.dao.MyTableDao
        
        
        
            
                timingAdvisor
            
        
    
    

提交回复
热议问题