From: <log...@li...> - 2015-12-22 19:36:02
|
John, you hit the right forum. I would say that writing to the same file from different process was not generally very good idea. Depending on many circumstances your output might look like expected, but sooner or later you most probably will see your log lines quite intermixed and not readable. For instance, depending on the buffering preferences, your calls will be flushed to disk fully or partially, and without external synchronization for the log file there is no guarantee for proper result. Such sync although would be total overkill for the logging purposes. Hiding filename from the user of the library in this case looks like advice. I would suggest you to log to different files with timestamps and sync on them or to set up any kind of communication channel between your processes and write to log file from only one process. On Tue, Dec 22, 2015 at 6:43 PM, <log...@li...> wrote: > > I see that FileAppender::_fileName is protected. It would be great if there > were an accessor: > > > const std::string & FileAppender::getFileName() const { > return _fileName; > } > > > I have some C++ code that invokes a python script (using popen) and I would > like the python script to log to the same file as the calling C++ code. For > this, I'd like to walk the appenders, and for any FileAppenders, ask them > what their filename is, so I can pass the filename to my python script. > > > Is this reasonable? Is this list the correct forum for asking for such a > thing? > > > -John Gregg > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Log4cpp-devel mailing list > Log...@li... > https://lists.sourceforge.net/lists/listinfo/log4cpp-devel > |