Boost logo

Boost :

Subject: Re: [boost] [log] Wide Character Backend file problems
From: Sivaram Kannan (siva.devel_at_[hidden])
Date: 2010-08-15 10:00:02


Hi Andrey,

> The add_common_attributes function works for narrow-character logging.
> Wide-character counterpart is wadd_common_attributes. This may be the
> culprit, since the standard attributes are not found by the formatter and
> thus no log record passes to the sink. You should be able to see that by
> exceptions that are thrown by the formatter, unless you suppress them.
>

Thanks for your prompt reply. I changed the code to wadd_common_attributes()
but the log still did not get created. Am I right in mentioning the strings
like TimeStamp with L"TimeStamp" and ketwords::file_name =
L"C:\\test\\test.log" during initialization. One warning that I get during
compilation is the following. Does the following relevant to my problem? I
noticed I got the same warning when compiling for normal character as well.

 c:\documents and settings\administrator\my
> documents\softwares\boost_1_43_0\boost\log\sources\global_logger_storage.hpp(122)
> : while compiling class template member function 'void
> boost::log_mt_nt5::sources::aux::logger_singleton<TagT>::init_instance(void)'

        with

        [

            TagT=bmr_log

        ]

        c:\documents and
> settings\administrator\desktop\bzr-repo\cnbc\branch-refactoring-p1\cnbc\src\cnbc\logsink.h(36)
> : see reference to class template instantiation
> 'boost::log_mt_nt5::sources::aux::logger_singleton<TagT>' being compiled

        with

        [

            TagT=bmr_log

        ]

boost::function< void (std::wostream&, boost::log::wrecord const&) >
> formatter =

boost::log::formatters::wstream

            << boost::log::formatters::date_time< boost::posix_time::ptime
> >(L"TimeStamp") << L" *"

<< boost::log::formatters::attr< int >(L"Severity") << L"* " <<
> boost::log::formatters::wmessage();

> boost::shared_ptr<

sinks::synchronous_sink<boost::log::sinks::wtext_file_backend>

> sink = boost::log::winit_log_to_file(

    keywords::file_name = L"C:\\test\\test.log", // file name
> pattern

        keywords::rotation_size = 1 * 1024 * 1024, // rotate files
> every 1 MiB...

keywords::open_mode = std::ios_base::app,

keywords::auto_flush = true

      );

> sink->locked_backend()->set_formatter(formatter);

> // Register common attributes

boost::log_mt_nt5::wadd_common_attributes();

Appreciate your helpful response.

Thanks,
Siva.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk