나의 이야기

log4j.xml이 두 개였네!

레드얼더 2017. 1. 17. 20:13
# menu.jsp # 
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={
	"file:src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml",
	"file:src/main/webapp/WEB-INF/spring/root-context.xml"})
public class TestBoardMap {
	private static final Logger logger = (Logger) LoggerFactory.getLogger(TestBoardMap.class);	
	@Autowired private IBoardMapService boardMapServiceImpl = null;
	@Test
	public void list(){
		List<BoardMapDTO> list = boardMapServiceImpl.list();	
		for(BoardMapDTO obj :list){
			logger.debug("=========>" + obj);
		}	
	}


컨디션이 근래 들어 최악이었던 오늘, JUint로 controller를 테스트하는데 콘솔에 debug 메세지가 뿌려지질 않는다.
이 녀석과 반나절쯤 씨름하다 알게 된 사실은, 어이없게도 log4j.xml이 한 개가 아니라는 사실...


I just needed to put the log4j.properties in the src/test/resources and it will override the one in src/main/resources during the tests. :)
– PedroD Aug 4 '16 at 23:01

http://stackoverflow.com/의 질문에 달린 답변을 보고 알게 됐다는....