Is Log4cplus RollingFileAppender Asynchronous or not

匿名 (未验证) 提交于 2019-12-03 01:34:02

问题:

I'm going to add Log4cplus for our application. Our application is written in C++ and it is multithreaded. I want to use the Log4Cplus RollingFileAppender for the same.

I know Log4Cplus was derived from Java Log4j. As I didn't know Java well, I have no idea on Log4j.

My questions are as follows,

  1. Is Log4Cplus RollingFileAppender asynchronous or not ?. Then what is the use of AsyncAppender ?
  2. Is RollingFileAppender thread safe ?
  3. Do I need to handle code for thread safety with RollingFileAppender or is it inbuilt ?

Also can some one point me some examples for multi threaded rollingfileappender ?

回答1:

RollingFileAppender is thread safe and it is not asynchronous. To get asynchronicity, you would have to wrap the AsyncAppender around it. There is nothing special about using RollingFileAppender from multiple threads when compare to single thread. Synchronization is done for all appenders in Appender::doAppend().



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!