Linux で log4cplus-1.1.2 を使用しています。thread_nameとを設定する方法はないようthread_name2ですstruct per_thread_data。
struct per_thread_dataファイル internal.h の 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 は、ロギングのために各スレッドにそのような構造体を割り当てます。
LOG4CPLUS_EXPORT log4cplus::tstring const & getCurrentThreadName()andを呼び出して、 and にそれぞれLOG4CPLUS_EXPORT log4cplus::tstring const & getCurrentThreadName2()アクセスする唯一の方法です。ただし、ユーザーはこれらの値を変更できません。thread_namethread_name2