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.




Reply via email to