boost log to display source code name and lines
Hi, I am looking for good log library to replace google log, my plan is to use boost log, but I am not sure if it is mature or it has been used seriously. It lacks some simple basic features such as display source code name and lines in log file, I've searched on line discussion, there are many suggestion to fix it in piece of code, but I could not get that work, difficult to use it may be overstated. Are there any good examples to display source program name and lines similar to asio socket examples on line? What is your opinion about boost log? Should I still pursue it? Thank you. - jhh
On 12/28/18 12:36 AM, hh h via Boost wrote:
Hi,
I am looking for good log library to replace google log, my plan is to use boost log, but I am not sure if it is mature or it has been used seriously.
I don't have any hard numbers, but the library is fairly mature and there are real world users.
It lacks some simple basic features such as display source code name and lines in log file, I've searched on line discussion, there are many suggestion to fix it in piece of code, but I could not get that work, difficult to use it may be overstated. Are there any good examples to display source program name and lines similar to asio socket examples on line?
Given that you've found examples online, could you describe what you've tried and what doesn't work? Also, did you try searching on StackOverflow? I remember there were examples of what you're asking.
I'd like to run a macro which can display file name and code lines by calling LOG(debug) << "debug here"; the following example answered Mar 10 '16 at 8:50 by jma looks good, but I could not compile it, I am running on ubuntu 18 that the boost version is 1.65: https://stackoverflow.com/questions/35895199/boost-log-and-severity-local-at... error: no matching function for call to ‘boost::log::v2_mt_posix::core::add_sink(std::shared_ptr<boost::log::v2_mt_posix::sinks::synchronous_sink<boost::log::v2_mt_posix::sinks::text_file_backend>
&)’ logging::core::get()->add_sink(sink);
Another one in following link even got more errors I won't be bothered to post. http://gernotklingler.com/blog/simple-customized-logger-based-boost-log-v2/ error: missing template arguments before ‘logger’ boost::log::sources::severity_logger_mt logger; ...... Thanks Andrey. On 12/28/18, Andrey Semashev via Boost <boost@lists.boost.org> wrote:
On 12/28/18 12:36 AM, hh h via Boost wrote:
Hi,
I am looking for good log library to replace google log, my plan is to use boost log, but I am not sure if it is mature or it has been used seriously.
I don't have any hard numbers, but the library is fairly mature and there are real world users.
It lacks some simple basic features such as display source code name and lines in log file, I've searched on line discussion, there are many suggestion to fix it in piece of code, but I could not get that work, difficult to use it may be overstated. Are there any good examples to display source program name and lines similar to asio socket examples on line?
Given that you've found examples online, could you describe what you've tried and what doesn't work? Also, did you try searching on StackOverflow? I remember there were examples of what you're asking.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
On 12/28/18 10:42 AM, hh h wrote:
I'd like to run a macro which can display file name and code lines by calling LOG(debug) << "debug here"; the following example answered Mar 10 '16 at 8:50 by jma looks good, but I could not compile it, I am running on ubuntu 18 that the boost version is 1.65:
https://stackoverflow.com/questions/35895199/boost-log-and-severity-local-at...
error: no matching function for call to ‘boost::log::v2_mt_posix::core::add_sink(std::shared_ptr<boost::log::v2_mt_posix::sinks::synchronous_sink<boost::log::v2_mt_posix::sinks::text_file_backend>
&)’ logging::core::get()->add_sink(sink);
Boost.Log uses boost::shared_ptr, not std::shared_ptr.
Another one in following link even got more errors I won't be bothered to post.
http://gernotklingler.com/blog/simple-customized-logger-based-boost-log-v2/
error: missing template arguments before ‘logger’ boost::log::sources::severity_logger_mt logger; ......
The quoted code sample in the linked blog page is indeed missing template arguments in a few places. The original code on GitHub (https://github.com/gklingler/simpleLogger) seems to be better, although I didn't try to compile it. I guess, some parts got lost in the blog due to missing HTML escaping. PS: Don't top-post, please.
That's so helpful, thank you very much Andrey. On 12/28/18, Andrey Semashev via Boost <boost@lists.boost.org> wrote:
On 12/28/18 10:42 AM, hh h wrote:
I'd like to run a macro which can display file name and code lines by calling LOG(debug) << "debug here"; the following example answered Mar 10 '16 at 8:50 by jma looks good, but I could not compile it, I am running on ubuntu 18 that the boost version is 1.65:
https://stackoverflow.com/questions/35895199/boost-log-and-severity-local-at...
error: no matching function for call to ‘boost::log::v2_mt_posix::core::add_sink(std::shared_ptr<boost::log::v2_mt_posix::sinks::synchronous_sink<boost::log::v2_mt_posix::sinks::text_file_backend>
&)’ logging::core::get()->add_sink(sink);
Boost.Log uses boost::shared_ptr, not std::shared_ptr.
Another one in following link even got more errors I won't be bothered to post.
http://gernotklingler.com/blog/simple-customized-logger-based-boost-log-v2/
error: missing template arguments before ‘logger’ boost::log::sources::severity_logger_mt logger; ......
The quoted code sample in the linked blog page is indeed missing template arguments in a few places. The original code on GitHub (https://github.com/gklingler/simpleLogger) seems to be better, although I didn't try to compile it. I guess, some parts got lost in the blog due to missing HTML escaping.
PS: Don't top-post, please.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
- Every time restarted the program, it restarted the new log file, even the old log file size was small. Hard to debug when program was restarted frequently. - Separated error, warning and debug log files, too many log files. - The log name format was clumsy and cannot be changed. - Roll over was difficult.
On Sat, Jan 5, 2019 at 2:56 AM hh h <jupiter.hce@gmail.com> wrote:
- Every time restarted the program, it restarted the new log file, even the old log file size was small. Hard to debug when program was restarted frequently. - Separated error, warning and debug log files, too many log files. - The log name format was clumsy and cannot be changed. - Roll over was difficult.
Thanks. Are you using a log analytics tool (or something like systemd's journal) to consume your logs or are you looking at them directly?
Not yet, currently I only use the log file for debugging purpose, but it'll be beneficial to use log analytics tool to monitor the system and check security. Are you using any log analytics tools? I'll be interested in any open source log analytics tools you are using. Thanks.
On Sun, Jan 6, 2019, 4:05 PM hh h <jupiter.hce@gmail.com wrote:
Not yet, currently I only use the log file for debugging purpose, but it'll be beneficial to use log analytics tool to monitor the system and check security. Are you using any log analytics tools?
Yes, that's the primary way we ingest and view logs. Unfortunately there doesn't seem to be any open source options that meet our requirement. My thought is that the future lies in these log aggregation tools (hopefully open source) and the log output file style doesn't matter that much. I'd very much like to see the standard library include logging of some sort so the industry can share APIs that log. The last time I checked out Boost.Log it struck me as overly complicated for engineering use cases, but that was several years ago. The documentation at least heavily depended on an anonymous function EDSL.
"The last time I checked out Boost.Log it struck me as overly complicated for engineering use cases, but that was several years ago. The documentation at least heavily depended on an anonymous function EDSL." I am not familiar with EDSL, did you mean only the documentation depended on EDSL, not the log design and code, right? I think that complicity could be the reason driven people away, I admire it has many good features, but I haven't seen its popularity comparing to the google log, but I could be wrong.
participants (3)
-
Andrey Semashev
-
David Sankel
-
hh h