I use log4cplus-1.1.2 in Linux. It seems that no way to set thread_name
and thread_name2
in struct per_thread_data
.
The definition of struct per_thread_data
as followed in file internal.h at line 111-130:
//! Per thread data.
struct per_thread_data
{
per_thread_data ();
~per_thread_data ();
tostringstream macros_oss;
tostringstream layout_oss;
DiagnosticContextStack ndc_dcs;
MappedDiagnosticContextMap mdc_map;
log4cplus::tstring thread_name;
log4cplus::tstring thread_name2;
gft_scratch_pad gft_sp;
appender_sratch_pad appender_sp;
log4cplus::tstring faa_str;
log4cplus::tstring ll_str;
spi::InternalLoggingEvent forced_log_ev;
std::FILE * fnull;
log4cplus::helpers::snprintf_buf snprintf_buf;
};
log4cplus will allocate such struct for each thread for logging.
Call LOG4CPLUS_EXPORT log4cplus::tstring const & getCurrentThreadName()
and LOG4CPLUS_EXPORT log4cplus::tstring const & getCurrentThreadName2()
are the only way to access thread_name
and thread_name2
respectively. However, the user cannot modify they values.