0

I'm evaluating log4cplus for a multi threaded C++ application on linux. The TTCCLayout and the PatternLayout allow the thread name to be displayed. In my tests there was never a name but just a meaningless number. I'm not using the thread class of log4cplus. How does log4cplus determine this thread name and is it possible to set it myself?

Roger Rowland
  • 25,885
  • 11
  • 72
  • 113
LeSpocky
  • 489
  • 1
  • 6
  • 16

1 Answers1

2

Log4cplus (as of version 1.1.1 or earlier) does not have any PatternLayout formatter for thread names. It only has two thread related formatters:

  • %t - prints thread ID; for *nix, it is whatever value pthread_t represents, usually an int value or a pointer value

  • %T - prints alternative thread ID; for Linux, prints the value returned by syscall (SYS_gettid)

There is definitely some room for improvement.

wilx
  • 17,697
  • 6
  • 59
  • 114
  • You're right and that's what I was told now [on the log4cplus mailing list](http://sourceforge.net/mailarchive/forum.php?thread_name=CAKw7uVhT9_xEac_svRUmtLuLqhW_yohzvRQXtQzt5rvSXC5VTw%40mail.gmail.com&forum_name=log4cplus-devel) as well. However there are NDC or MDC facilities I could use. I'll have another look in the log4cplus code for that. O:-) Thanks for your help. :-) – LeSpocky May 15 '13 at 11:45