Language/Java
strut2 + tiles jsp 경로 로그 찍기
후늬뉨
2017. 8. 31. 17:11
구시스템 분석중에 jsp 경로를 찾기 쉽게하기위한 방법을 찾아보다가 없는듯하여 타일즈 관련 클래스를 직접 수정했다.
org.apache.struts2.views.tiles.TilesResult.java
public void doExecute(String location, ActionInvocation invocation) throws Exception { setLocation(location); ServletContext servletContext = ServletActionContext.getServletContext(); TilesContainer container = TilesAccess.getContainer(servletContext); HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); if (log.isDebugEnabled()) { log.debug("-------------------------------------------------------------------"); log.debug("request uri : "+request.getRequestURI()); log.debug("-------------------------------------------------------------------"); } container.render(location, request, response); }
org.apache.tiles.impl.BasicTilesContainer.java
protected void render(TilesRequestContext request, String definitionName) { if (log.isDebugEnabled()) { log.debug("Render request recieved for definition '" + definitionName + "'"); } Definition definition = getDefinition(definitionName, request); //===========타일즈 로깅 추가 시작 2017-08-31 by hhjeong========== if (log.isDebugEnabled()) { log.debug("definition:"+definition); Iteratoriter = definition.getAttributeNames(); log.debug("-------------------------------------------------------------------"); log.debug("body : "+definition.getAttribute("body")); log.debug("-------------------------------------------------------------------"); while (iter.hasNext()) { String key = iter.next(); log.debug(key + " : "+definition.getAttribute(key)); } log.debug("-------------------------------------------------------------------"); } //===========타일즈 로깅 추가 끝 2017-08-31 by hhjeong========== if (definition == null) { if (log.isWarnEnabled()) { String message = "Unable to find the definition '" + definitionName + "'"; log.warn(message); } throw new NoSuchDefinitionException(definitionName); } render(request, definition); }
log4j.properties 에 아래 패키지 추가
log4j.logger.org.apache.struts2=DEBUG log4j.logger.org.apache.tiles.impl=DEBUG