You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "atari83 (via GitHub)" <gi...@apache.org> on 2024/01/21 23:21:37 UTC
[I] Question: using AsyncAppender [logging-log4cxx]
atari83 opened a new issue, #332:
URL: https://github.com/apache/logging-log4cxx/issues/332
Hello!
So, I'm working on a program that produce about 100K rows of data per minute and approximately each row is about 2K. While using simple and straightforward `FileAppender` works just fine. I was thinking how could I optimize it more.
Please help me to see if I understand it correctly:
1- Using AsyncAppender would potentially assist me to solve the write-operations blocking issues.
2- It is possible to configure the BufferSize (bounded-buffer) parameter in XML DOM. But then I dont know what is default value, or how should I calculate it based on my program context.
3- The FileAppender also exposes BufferedIO and BufferSize. Again, I dont know what is default behavior and If I need to use that or not (the calculation method..)
4- Based on the nature of AsyncAppender class (asynchronous-based operations), there could be a situation that some data get aborted when application exited. If thats correct, Is there anyway that let me enforce the AsyncAppender object to write down remaining data before program exited ?
My last question is not related to Appenders, but I just wanted to know if it is possible to call the `DOMConfigurator::configure` function multiple times in my program ? I'm asking this, because lets say I'm using logging different logs for different log-levels. So, based on the configured value for <priority> in <category> tags, I would actually let the program to generate the logs I'd expected to see. For now, every time I want to change the log-level I have to restart the program. I was thinking if it applicable to call the function to reload the xml file to change the log-level for example and without requiring program to get restart ?
Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Question: using AsyncAppender [logging-log4cxx]
Posted by "swebb2066 (via GitHub)" <gi...@apache.org>.
swebb2066 commented on issue #332:
URL: https://github.com/apache/logging-log4cxx/issues/332#issuecomment-1902810015
> FileAppender works just fine. I was thinking how could I optimize it more.
The default value of `BufferedIO` is false [documented here](https://logging.apache.org/log4cxx/latest_stable/classlog4cxx_1_1FileAppender.html#a0126112f63df5a5c5e8adfb72c091d64) . Configuring the `BufferedIO` of `FileAppender` to `true` greatly (by up to 10 times) increases output rate.
> BufferSize (bounded-buffer) parameter for AsyncAppender
The default value is 128
> could be a situation that some data get aborted when application exited.
I believe `AsyncAppender` will write all events before your program exits (unless abnormally terminated). However, if your program adds events to `AsyncAppender` faster then the background thread can write and the buffer overflows, then logging events will be discarded. Be sure to set `BufferedIO` of `FileAppender` to `true` in the appender attached to `AsyncAppender`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Question: using AsyncAppender [logging-log4cxx]
Posted by "rm5248 (via GitHub)" <gi...@apache.org>.
rm5248 commented on issue #332:
URL: https://github.com/apache/logging-log4cxx/issues/332#issuecomment-1902818118
> > possible to call the DOMConfigurator::configure function multiple times in my program
>
> Yes. `DOMConfigurator::configure` is most usefully automatically called when you change the configuration file. To use this feature call `DOMConfigurator::configureAndWatch`
Note that the `configureAndWatch` methods simply look every X number of seconds to see if the file has changed. You can also load the file as soon as it changes using some sort of platform-dependent mechanism(e.g. `inotify` on Linux). If you're using Qt, you can compile the Qt support for Log4cxx and use [`log4cxx::qt::configureFromFileAndWatch`](https://github.com/apache/logging-log4cxx/blob/cfcd2ab940dd654ea030c497cb6a7252f1034e1d/src/main/include/log4cxx-qt/configuration.h#L42) which does this for you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Question: using AsyncAppender [logging-log4cxx]
Posted by "atari83 (via GitHub)" <gi...@apache.org>.
atari83 closed issue #332: Question: using AsyncAppender
URL: https://github.com/apache/logging-log4cxx/issues/332
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Question: using AsyncAppender [logging-log4cxx]
Posted by "swebb2066 (via GitHub)" <gi...@apache.org>.
swebb2066 commented on issue #332:
URL: https://github.com/apache/logging-log4cxx/issues/332#issuecomment-1902814172
> possible to call the DOMConfigurator::configure function multiple times in my program
Yes. `DOMConfigurator::configure` is most usefully automatically called when you change the configuration file. Do use this feature call `DOMConfigurator::configureAndWatch`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Question: using AsyncAppender [logging-log4cxx]
Posted by "atari83 (via GitHub)" <gi...@apache.org>.
atari83 commented on issue #332:
URL: https://github.com/apache/logging-log4cxx/issues/332#issuecomment-1903588627
Got it ! Thank you Stephen, Robert for the responses :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org