boost-log

how to print ProcessID and ThreadID in dec-format with boost.log

喜欢而已 提交于 2019-12-22 04:35:14
问题 I use boost.log in my program, and the default formatter outputs the ProcessID and ThreadID in hex-format, anyone knows how to print them in dec-format, thanks. this is the github of my code : https://github.com/owenliang/boost_asio, thanks. boost::log::formatter scope_formatter = boost::log::expressions::stream << "[" << boost::log::expressions::format_date_time<boost::posix_time::ptime>("TimeStamp", "%Y-%m-%d %H:%M:%S") << "] [" << boost::log::expressions::attr<boost::log::attributes:

Unresolved external when using boost log

大城市里の小女人 提交于 2019-12-21 20:33:01
问题 I'm having problem while trying to use boost log. I'm getting following error message: 1>------ Build started: Project: vms, Configuration: Release x64 ------ 1> main.cpp 1> Linking to lib file: libboost_system-vc140-mt-1_60.lib 1> Linking to lib file: libboost_date_time-vc140-mt-1_60.lib 1> Linking to lib file: libboost_regex-vc140-mt-1_60.lib 1> Linking to lib file: libboost_log-vc140-mt-1_60.lib 1> Linking to lib file: libboost_filesystem-vc140-mt-1_60.lib 1> Linking to lib file: libboost

How to redirect Boost.Log to file

时间秒杀一切 提交于 2019-12-20 18:02:33
问题 I want a simple log file in a concurrent application. I've download Boost.Log v2.0 and using compiled it with Boost 1.53.0 . The problem is that Boost.Log output on console. I'm using BOOST_LOG_TRIVIAL(trace) . Is there a nice way to redirect BOOST_LOG_TRIVIAL to a file? 回答1: You can make BOOST_LOG_TRIVIAL use a file with (assuming that namespace logging = boost::log; : #include <boost/log/core.hpp> #include <boost/log/trivial.hpp> #include <boost/log/expressions.hpp> #include <boost/log

Boost-log linker error

前提是你 提交于 2019-12-17 20:55:48
问题 i've downloaded and builded Boost 1.55 from source. I'm trying to use Boost-log. In basic case (http://boost-log.sourceforge.net/libs/log/doc/html)/log/tutorial.html#log.tutorial.trivial it's working fine without any problems, but when i try to use some more advanced features(like this - http://boost-log.sourceforge.net/libs/log/example/doc/tutorial_fmt_stream.cpp ) i'm getting this error: main.obj : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem::path_traits:

Boost.Log - how to configure a text sink backend to append to rotated files

你离开我真会死。 提交于 2019-12-17 19:08:41
问题 I have a sinks::text_file_backend sink. Say I already have a few rotated log files: myLog001.log, myLog002.log and so on I want the sink to keep writing to the last rotated file - myLog002.log, append to its contents and continue rotation from there on. I have only managed to find keywords::open_mode = append but this only appends on top of the existing myLogX files, making them larger and of course very hard to read. Can this be done in Boost.Log? 回答1: That functionality is built in to the

why syslog sink sends same records on all the sinks when a sink is member of class?

為{幸葍}努か 提交于 2019-12-13 03:32:22
问题 I have written following code to send logs to remote syslog( rsyslog on remote unix machine ) from my windows machine using boost-log . I am using syslog_backend . #include <boost/config.hpp> #if !defined(BOOST_WINDOWS) #define BOOST_LOG_USE_NATIVE_SYSLOG #endif #include <string> #include <iostream> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/log/common.hpp> #include <boost/log/expressions.hpp> #include <boost/log/attributes.hpp> #include <boost/log/sinks/sync_frontend.hpp>

Properly overload operator << in Boost.Log

只谈情不闲聊 提交于 2019-12-12 10:56:54
问题 In the Boost.Log documentation, it is said that Note The library uses basic_formatting_ostream stream type for record formatting, so when customizing attribute value formatting rules the operator<< must use basic_formatting_ostream instead of std::ostream . However, throughout the documentation, all I see is overloading operator << on std::ostream rather than basic_formatting_ostream in the example code. For example, see the overload for the custom type severity_level here. According to my

No logs file getting created

与世无争的帅哥 提交于 2019-12-11 18:19:19
问题 I am using the example at the following link. https://www.boost.org/doc/libs/1_57_0/libs/log/doc/html/log/detailed/utilities.html#log.detailed.utilities.setup.settings_file My code is as follows. #include "stdafx.h" #include <iostream> #include <fstream> #include <boost/log/core.hpp> #include <boost/log/trivial.hpp> #include <boost/log/expressions.hpp> #include <boost/log/utility/setup/file.hpp> #include <boost/log/utility/setup/common_attributes.hpp> #include <boost/log/utility/setup/from

auto flush in boost syslog sink backend (boost 1.59)

谁说我不能喝 提交于 2019-12-11 16:50:42
问题 Is there any method to flush() in syslog backend. I am facing issue with boost syslog sink, after 6 log messages the 7th message is not getting logged into syslog (stays in buffer) until new log message is called. My syslog implementation: typedef sinks::synchronous_sink< sinks::syslog_backend > sink_t; boost::shared_ptr< sink_t > syslogSink( new sink_t( keywords::facility = sinks::syslog::local0, keywords::use_impl = sinks::syslog::native )); sinks::syslog::custom_severity_mapping< std:

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