Menu

#140 RollingFileAppend prints log name to std::cout

Feature Request
closed-fixed
nobody
cout (1)
5
2016-08-02
2016-06-16
idc
No

In RollingFileAppender.cpp function "rollover" the following line occurs:

std::cout << last_log_filename << std::endl;

Can this be removed ? If my app outputs some data to std::cout and also logs different data to log I randomly get the Logfile output as well due to this line

Related

Bugs: #140

Discussion

  • Alexander Perepelkin

    Hello,
    This line is actually put there for purpose. It is expected that different parts of application put messages to stdout sometimes. When you want to see messages from particular component, logger suits best there. Do you really need stdout clean from anything what your code has not issued?

     
    • idc

      idc - 2016-06-17

      Hi,

      Am totally surprised at this, i would not any expect and decent 3rd party libraries to use stdout for arbitary status messages. Log4cpp has no idea what scenario it is being run in hence should not presume its okay to output messages to stdout / stderr.
      You even state logger suits best, so why is this message not sent to a logger? I'm not even sure why I'd need to know the log file has rolled ? (I'm pretty sure Log4j doesn't tell the user it has rolled - why does log4cpp need to ?)

      If i was to right a command line tool using log4cpp to log what is happening but provide a console based menu occasionally my menu could start printing "last_log_filename" ?

      From: "Alexander Perepelkin" sanchouss_@users.sf.net
      To: "[log4cpp:bugs]" 140@bugs.log4cpp.p.re.sf.net
      Sent: Friday, 17 June, 2016 10:42:46
      Subject: [log4cpp:bugs] #140 RollingFileAppend prints log name to std::cout

      Hello,
      This line is actually put there for purpose. It is expected that different parts of application put messages to stdout sometimes. When you want to see messages from particular component, logger suits best there. Do you really need stdout clean from anything what your code has not issued?

      [bugs:#140] RollingFileAppend prints log name to std::cout

      Status: open
      Group: Feature Request
      Created: Thu Jun 16, 2016 10:16 AM UTC by idc
      Last Updated: Thu Jun 16, 2016 10:16 AM UTC
      Owner: nobody

      In RollingFileAppender.cpp function "rollover" the following line occurs:

      std::cout << last_log_filename << std::endl;

      Can this be removed ? If my app outputs some data to std::cout and also logs different data to log I randomly get the Logfile output as well due to this line

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/log4cpp/bugs/140/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #140

  • Alexander Perepelkin

    Libraries need to provide some diagnosis; 3rd party libs use either stdout/err or logs.
    Logging library using itself for diagnostic msgs would be nonsense, it has no other way than out/err.
    Imagine that lib would not serve its purpose without any output.
    Although your consideration regarding console tool seems reasonable.
    Would you expect in that cmd line tool that log4cpp start complaining about not being able to write or roll file?

     
    • idc

      idc - 2016-06-17

      Some fair points, in all the 3rd party libraries I've used before only one which output to stderr/stdout -- but in this case it was an error condition. Other libraries use return codes / error handling functions. (maybe its just the libraries i've used lack logging or is up to the programmer to deal with issues via the api responses (as opposed to looking at log output)

      I accept in case of logger this is not feasible (would be a nightmare to have to add exception/error handling code around every log call.)

      If log4cpp can't access a logfile or roll the existing file I guess that would make sense to output to stderr, but I still believe outputting the fact the log has rolled to be overkill, why does the user need that to be output at all, its a normal function of the log file to roll over - ie its not an unexpected error or problem

      From: "Alexander Perepelkin" sanchouss_@users.sf.net
      To: "[log4cpp:bugs]" 140@bugs.log4cpp.p.re.sf.net
      Sent: Friday, 17 June, 2016 12:28:40
      Subject: [log4cpp:bugs] #140 RollingFileAppend prints log name to std::cout

      Libraries need to provide some diagnosis; 3rd party libs use either stdout/err or logs.
      Logging library using itself for diagnostic msgs would be nonsense, it has no other way than out/err.
      Imagine that lib would not serve its purpose without any output.
      Although your consideration regarding console tool seems reasonable.
      Would you expect in that cmd line tool that log4cpp start complaining about not being able to write or roll file?

      [bugs:#140] RollingFileAppend prints log name to std::cout

      Status: open
      Group: Feature Request
      Created: Thu Jun 16, 2016 10:16 AM UTC by idc
      Last Updated: Fri Jun 17, 2016 09:42 AM UTC
      Owner: nobody

      In RollingFileAppender.cpp function "rollover" the following line occurs:

      std::cout << last_log_filename << std::endl;

      Can this be removed ? If my app outputs some data to std::cout and also logs different data to log I randomly get the Logfile output as well due to this line

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/log4cpp/bugs/140/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #140

  • Alexander Perepelkin

    • labels: --> cout
    • status: open --> closed-fixed
     
  • Alexander Perepelkin

    fixed

     

Log in to post a comment.