본문 바로가기

Programming/Linux_Platform

linux stand out 을 file 에 logging 하기

static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";


redirect_stdio(TEMPORARY_LOG_FILE);


static void redirect_stdio(const char* filename) {

    // If these fail, there's not really anywhere to complain...

    freopen(filename, "a", stdout); setbuf(stdout, NULL);

    freopen(filename, "a", stderr); setbuf(stderr, NULL);

}


'Programming > Linux_Platform' 카테고리의 다른 글

socketpair()  (0) 2015.10.19
linux signals  (0) 2015.10.19
linux namespace  (0) 2015.10.14
Android log command, logwrapper  (0) 2015.09.30
logcat 사용법 정리  (0) 2015.09.30