Skip to content

Commit cc44877

Browse files
committed
log : disable pid in log filenames
1 parent ad93962 commit cc44877

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

common/log.h

+18-17
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,23 @@
9797
#define LOG_TEE_TARGET stderr
9898
#endif
9999

100+
// NOTE: currently disabled as it produces too many log files
100101
// Utility to obtain "pid" like unique process id and use it when creating log files.
101-
inline std::string log_get_pid()
102-
{
103-
static std::string pid;
104-
if (pid.empty())
105-
{
106-
// std::this_thread::get_id() is the most portable way of obtaining a "process id"
107-
// it's not the same as "pid" but is unique enough to solve multiple instances
108-
// trying to write to the same log.
109-
std::stringstream ss;
110-
ss << std::this_thread::get_id();
111-
pid = ss.str();
112-
}
113-
114-
return pid;
115-
}
102+
//inline std::string log_get_pid()
103+
//{
104+
// static std::string pid;
105+
// if (pid.empty())
106+
// {
107+
// // std::this_thread::get_id() is the most portable way of obtaining a "process id"
108+
// // it's not the same as "pid" but is unique enough to solve multiple instances
109+
// // trying to write to the same log.
110+
// std::stringstream ss;
111+
// ss << std::this_thread::get_id();
112+
// pid = ss.str();
113+
// }
114+
//
115+
// return pid;
116+
//}
116117

117118
// Utility function for generating log file names with unique id based on thread id.
118119
// invocation with log_filename_generator( "llama", "log" ) creates a string "llama.<number>.log"
@@ -126,8 +127,8 @@ inline std::string log_filename_generator_impl(const std::string & log_file_base
126127
std::stringstream buf;
127128

128129
buf << log_file_basename;
129-
buf << ".";
130-
buf << log_get_pid();
130+
//buf << ".";
131+
//buf << log_get_pid();
131132
buf << ".";
132133
buf << log_file_extension;
133134

0 commit comments

Comments
 (0)