From: Václav H. <v.h...@sh...> - 2009-04-26 13:22:03
|
Semyon Kleinerman wrote, On 26.4.2009 11:49: > Hi Vaclav, > > I have a separate thread using log4cplus. There is a stack of log messages > and my thread executing them one by one. Now the parameters I have to > pass: > > 1) Original thread ID > 2) Original Time of log event > > TCCLayout is not friendly for me because it will print a wrong thread id > and a later time. > > By creating a custom layout I don't reach the target as the > InternalLoggingEvent doesn't let me to put any user data. The only way is > to format the whole message before sending it to log. > > Maybe the solution is to extend the InternalLoggingEvent members with some > pointer "m_pUserData" and to add one more parameter to the function > LOG4CPLUS_ERROR? All this sounds like are trying to do logging asynchronously in separate thread (speed concerns?). If you want to do such thing, then custom layout is not the way. Either implement a custom appender, that will push the logging work to separate thread (This is something that AsyncAppender on the 1.1 branch does.) or implement a custom logging layer using InternalLoggingEvent directly, filling in the thread ID before you give it to another thread. -- VH |