Passion/hadoop

Hadoop M/R 프로그래밍시 Logging 방법

sunshout 2011. 8. 18. 10:18
하둡 개발시 디버깅은 syslog 를 이용해서 가능하다

import org.apache.commons.logging.LogFactory;

import org.apache.commons.logging.Log;


// 메인 클래스에 LOG라는 변수를 선언함

public class FlowMR {
    private static final Log LOG = LogFactory.getLog(FlowMR.class);



// 실제 사용은

 public void reduce(Text key, Iterable<FlowWritable> values,
                       Context context
                       ) throws IOException, InterruptedException {

        ArrayList <FlowWritable> list1 = new ArrayList<FlowWritable>();

        //HashMap<(FlowKey,FlowValue)> myMap = new HashMap<FlowKey,FlowValue>();

        for (FlowWritable val : values) {
            LOG.info("FlowWritable");
            boolean merge = false;


해당 syslog는 하둡 폴더의 로그 디렉토리 아래에 존재한다
 
/logs/userlogs/attempt_201108180924_0003_r_000006_0

root@Cnode15:/usr/local/src/hadoop-0.20.2/logs/userlogs/attempt_201108180924_0003_r_000006_0# ls
log.index  stderr  stdout  syslog