I figured it out.

The library was creating the files in the application folder and only copying them to the target folder on rotation.

I included the target folder path in the file name and everything worked as I expected.

I do not know if this is the expected behavior.

Thank you anyway.

Enviado desde dispositivo móvil.
Sent from mobile device.

On Mar 14, 2014 6:21 PM, "Jarrett Chisholm" <j.chisholm@chisholmsoft.com> wrote:
Hi Manuel,

Here's how I setup my logger:

boost::log::register_simple_formatter_factory< boost::log::trivial::severity_level, char >("Severity");
   
boost::log::add_file_log(
    fileName,
    keywords::auto_flush = true,
    keywords::format = "[%TimeStamp%] - %Severity%: %Message%"
);

I needed to set the `keywords::auto_flush = true` parameter to true to get auto flush to work.  I'm using Boost log 1.55 in linux with gcc and windows with Visual Studio 2013.

I never tried setting the boost properties from a settings file, so I'm not sure about issues with that.

Hope that helps!

Cheers

Ps: If you'd like to see the full source code of my logger, you can see it at: https://github.com/jarrettchisholm/logger

On 14/03/14 08:33 AM, Manuel Torres wrote:
Hello,

I am using Boost Log 1.55 with MinGW 32-bits (GCC v.4.8.1) under Windows 7
64-bits and it seems that the "AutoFlush" parameter is not working when a
settings file is used. I thought it might have to do with the
"Asynchronous" parameter but, after setting four sinks with the
combinations of "AutoFlush" and "Asynchronous", I got the same result: the
log files are only created after the application is closed.

I would appreciate if someone could help.

This is the settings file I am testing with:
[Core]
DisableLogging=false
Filter="%Severity% < 6"

[Sinks.ConsoleSink]
Destination=Console
Format="[%TimeStamp%] <%Severity%> %Channel%: %Message%"
Asynchronous=true
AutoFlush=true
[Sinks.TextFileSink0]
Destination=TextFile
FileName="0_%Y%m%d%H%M%S_Node_%N.log"
Format="[%TimeStamp%] <%Severity%> %Channel%: %Message%"
Asynchronous=true
AutoFlush=true
Target="../log"
RotationSize=1000000
RotationTimePoint="00:00:00"
MaxSize=10000000
[Sinks.TextFileSink1]
Destination=TextFile
FileName="1_%Y%m%d%H%M%S_Node_%N.log"
Format="[%TimeStamp%] <%Severity%> %Channel%: %Message%"
Asynchronous=true
AutoFlush=false
Target="../log"
RotationSize=1000000
RotationTimePoint="00:00:00"
MaxSize=10000000
[Sinks.TextFileSink2]
Destination=TextFile
FileName="2_%Y%m%d%H%M%S_Node_%N.log"
Format="[%TimeStamp%] <%Severity%> %Channel%: %Message%"
Asynchronous=false
AutoFlush=true
Target="../log"
RotationSize=1000000
RotationTimePoint="00:00:00"
MaxSize=10000000
[Sinks.TextFileSink3]
Destination=TextFile
FileName="3_%Y%m%d%H%M%S_Node_%N.log"
Format="[%TimeStamp%] <%Severity%> %Channel%: %Message%"
Asynchronous=false
AutoFlush=false
Target="../log"
RotationSize=1000000
RotationTimePoint="00:00:00"
MaxSize=10000000



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users