Howdy.
I have the configuration file below and I load it from the code as depicted
below.The log files are being created, but they get overwritten each time I run
the application, instead of being appended each time I run.
code to load settings from config
file/////////////////////////////////////////////////////////////////////////////////
Name: ConfigureSinksFromIniFile()// Purpose: Load filter settings from
configuration
file//////////////////////////////////////////////////////////////////////////////*
static */ void GtsLog::ConfigureSinksFromIniFile(){ try { std::ifstream
cfgFile(".\\gtsLogConfig.INI"); try { if (cfgFile.is_open()) { try { // Add
some attributes logging::add_common_attributes();
// Read the settings and initialize logging library
logging::init_from_stream(cfgFile); return; } catch (std::exception& e) {
std::cout << "Could not load configuration file. Check for boost config syntax"
<< e.what() << std::endl; return; } } else { std::cout << "Could not open log
configuration file" << std::endl; return; //should we exit instead? } } catch
(std::exception& e) { std::cout << "Could not open log configuration file" <<
e.what() << std::endl; return; //should we exit instead? } } catch
(std::exception& e) { std::cout << "FAILURE: could not associate cfgFile to
.\\gtsLogCfg.ini " << e.what() << std::endl; return; //should we exit instead?
}}
Configuration File gtsConfig.INI===========================[Core]#
<DisableLogging> true=disable all logging; false=enable all logging Q. do we
care to disable specific channels?DisableLogging=false
# Sink settings sections#GTSMAIN logs everything to a text
file[Sinks.GTSMAIN]Destination="TextFile"
#<Asynchronous> if true, a thread is dedicated to writing to log, otherwise
blocks main thread to write.Asynchronous="true"
# Enables automatic stream flush after each log record.AutoFlush="true"
# Formatter string. Optional, by default only log record message text is
written.Format="[%TimeStamp%][%ThreadID%][%Severity%][%Channel%] %Message%"
#Target specifies where to save files when rotation
occurrsTarget="C:/Temp/GtsLogs"FileName="gtsMainLog_%3N.log"#RotationSize in
bytesRotationSize="1048576"#MaxSize - oldest file in the target directory will
be deleted when Maxsize(in bytes) is
reachedMaxSize=100485760OpenMode="append"#Apply no filter for the main log#
Sink-specific filter. Optional, by default no filter is
applied.#============================================================================================================[Sinks.ADM]Destination="TextFile"##<Asynchronous>
if true, a thread is dedicated to writing to log, otherwise blocks main thread
to write.Asynchronous="true"### Enables automatic stream flush after each log
record.AutoFlush="true"### Formatter string. Optional, by default only log
record message text is
written.Format="[%TimeStamp%][%ThreadID%][%Severity%][%Channel%]
%Message%"#Target="C:/Temp/GtsLogs"FileName="gtsAdm_%3N.log"##RotationSize in
bytesRotationSize="1048576"##MaxSize - oldest file in the target directory will
be deleted when Maxsize(in bytes) is reachedMaxSize=100485760##Apply no filter
for the main log## Sink-specific filter - anything in AGR channel. Optional, by
default no filter is applied.Filter="%Channel% matches
\"ADM\""##============================================================================================================[Sinks.AGR]Destination="TextFile"###<Asynchronous>
if true, a thread is dedicated to writing to log, otherwise blocks main thread
to write.Asynchronous="true"### Enables automatic stream flush after each log
record.AutoFlush="true"### Formatter string. Optional, by default only log
record message text is
written.Format="[%TimeStamp%][%ThreadID%][%Severity%][%Channel%]
%Message%"#Target="C:/Temp/GtsLogs"FileName="gtsAgr_%3N.log"##RotationSize in
bytesRotationSize="1048576"##MaxSize - oldest file in the target directory will
be deleted when Maxsize(in bytes) is reachedMaxSize=100485760## Sink-specific
filter - anything in AGR channel. Optional, by default no filter is
applied.Filter="%Channel% matches \"AGR\""
_______________________________________________
Boost-users mailing list
[email protected]
https://lists.boost.org/mailman/listinfo.cgi/boost-users