Giter Site home page Giter Site logo

Comments (9)

Lastique avatar Lastique commented on August 26, 2024 1

Yes, given that the file name is generated only once, there's no practical way to ensure appending happens while file collecting is enabled. Either appending won't happen (because of differing file names) or there will be name clashes when the file is collected. I'm working on a solution, though, so hopefully this problem will be resolved.

from log.

Lastique avatar Lastique commented on August 26, 2024

Appending will only work when the generated file name matches an existing file. This means that file names with timestamps will not work well with appending.

from log.

ercdude avatar ercdude commented on August 26, 2024

even if it's in the same time? In the example, if I open the application twice in the same minute, two file logs (file-mmddYY_HHMM_00.log and file-mmddYY_HHMM_01.log) will be created and the file name is the same.

Or you mean that if using time (any, even if it's just the year) the append is ignored?

from log.

Lastique avatar Lastique commented on August 26, 2024

even if it's in the same time?

It's the file names what matters. In your example, the timestamps do match, but the counter value doesn't.

The counter value doesn't match because you call scan_for_files, which by default updates the starting counter value the sink uses to generate the file name. That call is intended to be used with a file collector, so that the older rotated log files are tracked. You're not using one.

from log.

ercdude avatar ercdude commented on August 26, 2024

but if I remove the scan_for_files, new file still will be created. But instead of xxx00.log it will be xxx.log000

from log.

ercdude avatar ercdude commented on August 26, 2024

oooh, okay... I have to remove the file collector. So it's impossible to append and collect at the same time, is that it?

from log.

ercdude avatar ercdude commented on August 26, 2024

Okay, thanks!

Maybe a disclaimer here would be nice. :) I don't know if/how I can upload a documentation ""fix"", otherwise I would add

from log.

Lastique avatar Lastique commented on August 26, 2024

If you're interested, you can try if e823f88 helps. With it, you can modify your initialization code like this:

typedef boostlog_sinks::synchronous_sink< boostlog_sinks::text_file_backend > file_sink;
boost::shared_ptr< file_sink > sink(new file_sink(
      boostlog_keywords::auto_flush = true,
      boostlog_keywords::file_name = "file.log",
      boostlog_keywords::target_file_name = "file-%m%d%Y_%H%M_%2N.log",
      boostlog_keywords::rotation_size = 5 * 1024 * 1024,
      boostlog_keywords::format = "[%TimeStamp%][%ThreadID%] *%Severity%* %Message%",
      boostlog_keywords::open_mode = std::ios_base::app
));

from log.

ercdude avatar ercdude commented on August 26, 2024

Nice, I'll check it out asap. Thanks!

from log.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.