- 论坛徽章:
- 2
|
我在linux下做c++的开发,尝试着看一下cerr和clog这两个东西的区别。
我写了一个简单的测试程序,发现clog是和cerr一样,绑定在2号描述符上面的:当我把2>/dev/null重定向了以后,发现cerr和clog同时都没有了。
问题来了,如果看clog的说明,似乎不是绑定在cerr/cout上面的,而是依赖于系统的logging stream实现。
所以我的疑问是: linux系统下面是否有相关的设定来制定log输出到哪里?
----------------------------------------------------------------
The global objects std::clog and std::wclog control output to a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C output stream stderr, but, unlike std::cerr/std::wcerr, these streams are not automatically flushed and not automatically tie()'d with cout.
These objects are guaranteed to be initialized during or before the first time an object of type std::ios_base::Init is constructed and are available for use in the constructors and destructors of static objects (as long as <iostream> is included).
Unless sync_with_stdio(false) has been issued, it is safe to concurrently access these objects from multiple threads for both formatted and unformatted output.
|
|