boost-logging

My program doesn't support thread safe logging while using boost library

会有一股神秘感。 提交于 2019-12-11 11:37:45
问题 I am currently creating a class that should be used for logging purpose. But here one problem , it doesn't support thread synchronization. There is no problem when I run one by one thread. But there is problem while I run two or more threads at a time. Problem I am facing is: "If I create two threads to create two separate logs , but Two threads are colliding and write its log messages to both the files". If anyone find the problem , please help me to resolve it. BoostLogger.h : #pragma once

How can I manually flush a boost log?

ぐ巨炮叔叔 提交于 2019-12-06 04:13:03
问题 I'm playing with Boost.Log in boost 1.54.0 to see if it is a viable option for my application. In general, I don't have a problem with the buffering, so I'm not looking to turn on auto_flush or anything... but I noticed that messages that are logged before I call fork() are duplicated, and I'm wondering if it's because they are buffered, the buffer gets duplicated when the process image is copied, and then both processes eventually write their buffer copies to the log file... So basically, I

How can I manually flush a boost log?

谁都会走 提交于 2019-12-04 10:24:15
I'm playing with Boost.Log in boost 1.54.0 to see if it is a viable option for my application. In general, I don't have a problem with the buffering, so I'm not looking to turn on auto_flush or anything... but I noticed that messages that are logged before I call fork() are duplicated, and I'm wondering if it's because they are buffered, the buffer gets duplicated when the process image is copied, and then both processes eventually write their buffer copies to the log file... So basically, I'd like to just do a manual flush on the log, one time only, immediately before I call fork() in order

boost log to print source code file name and line number

故事扮演 提交于 2019-11-30 03:39:40
I'm using Boost(1.55.0) Logging in my C++ application. I have been able to generate log of this format [2014-Jul-15 10:47:26.137959]: <debug> A regular message I want to be able to add source file name and line number where the log is generated. [2014-Jul-15 10:47:26.137959]: <debug> [filename:line_no] A regular message example: [2014-Jul-15 10:47:26.137959]: <debug> [helloworld.cpp : 12] A regular message Source Code: #include <boost/log/core.hpp> #include <boost/log/trivial.hpp> #include <boost/log/expressions.hpp> #include <boost/log/sinks/text_file_backend.hpp> #include <boost/log/utility

Log file is not getting created

我与影子孤独终老i 提交于 2019-11-29 13:06:16
I need a global logger that I can use across multiple classes in my project. I want to have logger settings in an ini file. I start following example here and combined it with some suggestions at my earlier question here . My Logger.h is as follows. #pragma once #include <boost/log/common.hpp> #include <boost/log/attributes.hpp> #include <boost/log/utility/setup/from_stream.hpp> #include <boost/regex.hpp> #include <boost/log/expressions.hpp> #include <boost/log/sources/global_logger_storage.hpp> #include <boost/log/support/date_time.hpp> #include <boost/log/trivial.hpp> #include <boost/log

Boost.log: How to prevent the output will be duplicated to all added streams when it uses the add_file_log() function?

风格不统一 提交于 2019-11-29 07:00:25
I use the add_file_log() function to initialize a logging sink that stores log records into a text file. When I define several sinks, I have observed: a file is created for each sink. the output is copied to all files. This is my logger: class logger { public: logger(const logger&) =delete; logger(logger&&) =delete; logger& operator=(const logger&) =delete; logger& operator=(logger&&) =delete; static logger& get_instance( const std::string& file, bool console ) { boost::log::register_simple_formatter_factory< boost::log::trivial::severity_level, char >("Severity"); std::string the_format = "[

how to use boost log from multiple files with Gloa

陌路散爱 提交于 2019-11-28 19:50:11
I am trying to create a Global Logger within my entire application so I can use src::severity_logger_mt< >& lg = my_logger::get(); to get the global logger for different classes (resided in different files) logging. I try to follow the example listed in boost.org (as listed below). But does not seems to work. Did anyone know any example I can follow or what I need to do make if works. Thanks. http://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/detailed/sources.html BOOST_LOG_GLOBAL_LOGGER(my_logger, src::severity_logger_mt) // my_logger.h // =========== #include "my_logger.h" BOOST_LOG

Log file is not getting created

二次信任 提交于 2019-11-28 06:54:37
问题 I need a global logger that I can use across multiple classes in my project. I want to have logger settings in an ini file. I start following example here and combined it with some suggestions at my earlier question here. My Logger.h is as follows. #pragma once #include <boost/log/common.hpp> #include <boost/log/attributes.hpp> #include <boost/log/utility/setup/from_stream.hpp> #include <boost/regex.hpp> #include <boost/log/expressions.hpp> #include <boost/log/sources/global_logger_storage

Boost.log: How to prevent the output will be duplicated to all added streams when it uses the add_file_log() function?

醉酒当歌 提交于 2019-11-28 00:35:55
问题 I use the add_file_log() function to initialize a logging sink that stores log records into a text file. When I define several sinks, I have observed: a file is created for each sink. the output is copied to all files. This is my logger: class logger { public: logger(const logger&) =delete; logger(logger&&) =delete; logger& operator=(const logger&) =delete; logger& operator=(logger&&) =delete; static logger& get_instance( const std::string& file, bool console ) { boost::log::register_simple

how to use boost log from multiple files with Gloa

我的梦境 提交于 2019-11-27 12:33:14
问题 I am trying to create a Global Logger within my entire application so I can use src::severity_logger_mt< >& lg = my_logger::get(); to get the global logger for different classes (resided in different files) logging. I try to follow the example listed in boost.org (as listed below). But does not seems to work. Did anyone know any example I can follow or what I need to do make if works. Thanks. http://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/detailed/sources.html BOOST_LOG_GLOBAL