Changes between Version 4 and Version 5 of applicationContext

차이점 주위로
다음 차이점은 무시하기:
작성자:
mefour (IP: 122.101.189.54)
날짜/시간:
2012-01-19 PM 2:26:52 (13 년 전)
설명:

--

Legend:

변경되지 않음
추가됨
제거됨
변경됨
  • applicationContext

    v4 v5  
    145145 
    146146}}} 
     147 
     148-. ProfilingAdvice 
     149 
     150{{{ 
     151package com.everland.ws.doremi.common.log; 
     152 
     153import java.text.DecimalFormat; 
     154import java.text.SimpleDateFormat; 
     155import java.util.Date; 
     156import java.util.HashMap; 
     157import java.util.Locale; 
     158import java.util.Map; 
     159 
     160import org.aspectj.lang.ProceedingJoinPoint; 
     161import org.springframework.beans.factory.annotation.Autowired; 
     162import org.springframework.util.StopWatch; 
     163 
     164import com.everland.ws.doremi.common.domain.ReturnModel; 
     165import com.everland.ws.doremi.common.service.impl.XiLogDao; 
     166 
     167public class ProfilingAdvice { 
     168 
     169    @Autowired 
     170        private XiLogDao xiLogDao; 
     171     
     172        public Object trace(ProceedingJoinPoint joinPoint) throws Throwable { 
     173                Map log = new HashMap(); 
     174                 
     175                StopWatch stopWatch = new StopWatch(); 
     176                long startTime = System.currentTimeMillis(); 
     177                long endTime; 
     178                SimpleDateFormat formatter = new SimpleDateFormat ( "yyyyMMddHHmmss", Locale.KOREA ); 
     179                DecimalFormat df = new DecimalFormat("0.##");  
     180                 
     181            Object retVal = joinPoint.proceed(); 
     182 
     183            endTime = System.currentTimeMillis(); 
     184 
     185        endTime = System.currentTimeMillis (); 
     186        Date stDate = new Date ( startTime ); 
     187        Date edDate = new Date ( endTime );            
     188        String strStartDate = formatter.format ( stDate ); 
     189        String strEndDate = formatter.format ( edDate ); 
     190        String strResDate = df.format((Double.parseDouble(""+endTime) - Double.parseDouble(""+startTime))/1000); 
     191         
     192            ReturnModel model = (ReturnModel)retVal; 
     193             
     194            String interfaceId=joinPoint.getTarget().getClass().getName(); 
     195            String interfaceMethod=joinPoint.getSignature().getName(); 
     196            log.put("if_id", interfaceId);                                                                      //인터페이스 아이디 
     197            log.put("if_method", interfaceMethod);                                                      //인터페이스 메소드 
     198            log.put("st_date", strStartDate.substring(0, 8));                           //요청 시작일 
     199            log.put("st_time", strStartDate.substring(8));                                      //요청 시간 
     200            log.put("ed_date", strEndDate.substring(0, 8));                                     //응답 시작일  
     201            log.put("ed_time", strEndDate.substring(8));                                        //응답 시간 
     202            log.put("res_time", strResDate);                                                            //수행시간 
     203            log.put("status", model.getZSTATUS() != null ? model.getZSTATUS() : "N");   //처리결과 상태 
     204            log.put("message", model.getZMESSAGE()!= null ? model.getZMESSAGE() : "No Header Message"); //결과메세지 
     205             
     206             
     207//              for ( Iterator it = log.entrySet () .iterator () ; it.hasNext () ; ) {  
     208//                      Map.Entry entry = ( Map.Entry ) it.next () ;  
     209//                      Object key = entry.getKey () ;  
     210//                      Object value = entry.getValue () ;  
     211//                      System.out.println((String)key+" : "+(String)value); 
     212//              }  
     213                 
     214            xiLogDao.saveXiLog(log); 
     215            return retVal; 
     216             
     217             
     218//          StringBuffer logMessageStringBuffer = new StringBuffer(); 
     219//          logMessageStringBuffer.append(" 결과메세지 : "+model.getZMESSAGE()+"\r\n"); 
     220//          logMessageStringBuffer.append(" 인터페이스 아이디 : "+joinPoint.getTarget().getClass().getName()+"\r\n"); 
     221//          logMessageStringBuffer.append(" 메소드명 : "+joinPoint.getSignature().getName()+"\r\n"); 
     222//          logMessageStringBuffer.append(" 파라미터 : "+ joinPoint.getArgs()+"\r\n"); 
     223//          logMessageStringBuffer.append(" 요청 시작일 : "+ strStartDate.substring(0, 8)+"\r\n"); 
     224//          logMessageStringBuffer.append(" 요청 시간 : "+ strStartDate.substring(8)+"\r\n"); 
     225//          logMessageStringBuffer.append(" 응답 시작일 : "+ strEndDate.substring(0, 8)+"\r\n"); 
     226//          logMessageStringBuffer.append(" 응답 시간 : "+ strEndDate.substring(8)+"\r\n"); 
     227//          logMessageStringBuffer.append(" 수행시간 : "+ strResDate+"\r\n"); 
     228//          logMessageStringBuffer.append(" 처리결과 상태 : "+ model.getZSTATUS()+"\r\n"); 
     229//          System.out.println(logMessageStringBuffer.toString()); 
     230        } 
     231} 
     232 
     233}}}