Am Samstag, 18. Dezember 2004 22:30 schrieb Curt Arnold: > On Dec 18, 2004, at 3:02 PM, Tommi M�kitalo wrote: > > Hi, > > > > there is a problem printing thread-id on 64-bit: > > > > log4cxx uses "StringHelper::toString(int, apr_pool_t*)" to convert the > > current > > thread-id to a string. On my machine thead-id is 64 bit unsigned > > (unsigned > > long), but int is only 32 bit and signed. > > > > There is a elegant solution in c++: ostringstream. We can use > > ostringstream to > > build the whole message. There is less hassle with formatting types > > then and > > it is a portable solution. > > > > What do you think? > > Creating an ostringstream has a surprisingly high creation cost and > there have been at least some users that made reasonable cases for > avoiding STL dependency where possible. I wrote a pretty simplistic > 64-bit toString() equivalent in RelativeTimeFormat. Maybe if I brought > that into StringHelper. I know you will tell that. I like the standard-library very much and I use it, where I can. It would just be so easy to stream out all logmessages.
I quickly hacked it into log4cxx and my version now prints 64-bit thread-ids. I looked at your 64-bit toString() equivalent. It looks really ugly, but I fear that's the way to go. Tommi
