본문 바로가기

ETC

log4j


프로젝트에 log4j사용해야함.
필수입니다.
----------------------------------------------------------------------

web.xml에서
 
<context-param>
   <param-name>log4jConfigLocation</param-name>
   <param-value>classpath:log4j.xml</param-value>
  </context-param>

<listener>
   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
추가해야함^^
----------------------------------------------------------------------
사용시 컨트롤러에서
public Logger logger = Logger.getLogger(this.getClass());
멤버변수로 선언후
각메소드에서
logger.debug(artnum + "이 상세보기 되었어요");
이런식으로 사용됨

----------------------------------------------------------------------

----------------------------------------------------------------------
설정파일

'ETC' 카테고리의 다른 글