Programming/Linux_Platform
linux stand out 을 file 에 logging 하기
decdream
2015. 10. 19. 10:44
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);
}