I just remembered that for windows I had to create a version of
BOOST_DECLARE_LOG and BOOST_DEFINE_LOG for dll's, as in:
#define BOOST_DECLARE_LOG_DLL(log_name) \
struct log_name ## _log_class { enum { is_compile_time = 0, is_enabled =
1 }; }; \
BOOST_LOG_USE_IN_DLL_DECL ::boost::logging::logger & log_name##_log();
// note: you need to include before using this
#define BOOST_DEFINE_LOG_DLL(log_name,log_str) \
BOOST_LOG_USE_IN_DLL_DECL ::boost::logging::logger & log_name##_log() {
\
static ::boost::logging::mark_log_as_compile_time_t< (log_name ##
_log_class::is_compile_time != 0) > mark_logger(log_str); \
static ::boost::logging::logger l(log_str); return l; \
}
where
BOOST_LOG_USE_IN_DLL_DECL
is the usual __decl_export/import.
I think that may address the problem you are having.
Oliver
-----Original Message-----
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Austin Bingham
Sent: August 17, 2005 10:58 AM
To: boost-users@lists.boost.org; john@torjo.com
Subject: [Boost-users] boost logging from shared libraries
First, I wasn't sure where would be the most appropriate place to post this
question, so I apologize if it's gone to the wrong place.
I'm trying to figure out how to put logging statements in some shared
libraries which are then controlled via manipulate_logs() calls an the
executable that uses the libraries. It appears, after some rudimentary
experiments, that this does not work, and I was hoping to find out if there
is a way to do it.
The logging system, of course, does log manipulation using log names and
regular expression matching. As such, I assumed that logs were statically
allocated and, in some way, all registered with some central registry which
made them all available via their names.
Stepping through logging calls in the libraries seems to indicate that
logging code is being accessed and, as far as I can tell, the logs are
"enabled" and, in fact, trying to log messages (to cout, for what it's
worth). However, I don't see anything printed except for log messages
genereted from the executable's source code.
So, is what I'm trying to do even feasible? I would love to be able to have
diagnostics built into my libraries which I could dis/enable as necessary
from the executive level. Hopefully I'm just missing something simple.
Thanks.
--
Austin Bingham
"If I were creating the world I wouldn't mess about with butterflies and
daffodils. I would have started with lasers, eight o'clock, Day One!"
Evil
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users