I don't believe you will get anything except hex.

The relevant code is in loggingevent.cpp:

> const LogString LoggingEvent::getCurrentThreadName() {
> #if APR_HAS_THREADS
> #if defined(_WIN32)
>    char result[20];
>    DWORD threadId = GetCurrentThreadId();
>    apr_snprintf(result, sizeof(result), LOG4CXX_WIN32_THREAD_FMTSPEC,
> threadId);
> #else
>    // apr_os_thread_t encoded in HEX takes needs as many characters
>    // as two times the size of the type, plus an additional null byte.
>    char result[sizeof(apr_os_thread_t) * 3 + 10];
>    apr_os_thread_t threadId = apr_os_thread_current();
>    apr_snprintf(result, sizeof(result), LOG4CXX_APR_THREAD_FMTSPEC,
> (void*) &threadId);
> #endif
>    LOG4CXX_DECODE_CHAR(str, (const char*) result);
>    return str;
> #else
>    return LOG4CXX_STR("0x00000000");
> #endif
> }

Cory


On 4/17/2011 10:19 AM, Alessandro Ferrucci wrote:
> bump.
>
> Just wondering if anyone knows the answer to this question or knows
> that in fact it is not possible to have it any other way.
>
> Thank you,
> Alessandro Ferrucci
>
> On Thu, Apr 14, 2011 at 10:19 AM, Alessandro Ferrucci
> <alessandroferru...@gmail.com <mailto:alessandroferru...@gmail.com>>
> wrote:
>
>     Hello,
>     I have the following log4cxx.properties file:
>
>     log4j.rootLogger = DEBUG, CONSOLE, FILE
>
>     log4j.appender.FILE=org.apache.log4j.FileAppender
>     log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
>     log4j.appender.FILE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
>     log4j.appender.FILE.File=/home/ferru001/IslandAreas_Imaging/logs/log.txt
>
>     log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
>     log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
>     log4j.appender.CONSOLE.layout.ConversionPattern=%-5p %d [%t] %c: %m%n
>
>     I have a pthreads program and the thread IDs come out as
>
>     INFO  2011-04-14 10:07:39,217 [0x427a8940] TIFFReader: Initialize
>     inbound TCP socket
>     INFO  2011-04-14 10:07:39,217 [0x43baa940] TIFFReader: STARTED THREAD
>     INFO  2011-04-14 10:07:39,217 [0x431a9940] TIFFReader: STARTED
>     THREAD worker1
>     INFO  2011-04-14 10:07:39,218 [0x43baa940] TIFFReader: WAITING FOR
>     NEXT BATCH...
>
>     I start the threads as
>
>     if( (  returnVal = pthread_create(&t, NULL, register_function,
>     (void*)threadname.c_str() ))!=0)
>     {
>                 LOG4CXX_ERROR( logger, "pthread_create:Error
>     "<<returnVal<<"("<<errno<<")" );
>     }
>
>     Is there any way for the thread ID value in the log files to have
>     a more human readable value?
>
>     -- 
>     Signed,
>     Alessandro Ferrucci
>
>
>
>
> -- 
> Signed,
> Alessandro Ferrucci

Reply via email to