Giter Site home page Giter Site logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
I agree with that, probably one file per day

In log4j this feature is Rolling file log

Original comment by [email protected] on 15 Mar 2010 at 4:31

from google-glog.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
I think I answered the original issue (add log message into the same file) in 
Issue 
26:

INFO log file should have all log levels. Isn't it sufficient?

http://google-glog.googlecode.com/svn/trunk/doc/glog.html#severity

Note that messages of a given severity are logged not only in the logfile for 
that 
severity, but also in all logfiles of lower severity. E.g., a message of 
severity 
FATAL will be logged to the logfiles of severity FATAL, ERROR, WARNING, and 
INFO.

Original comment by [email protected] on 27 May 2010 at 10:26

from google-glog.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
It would be nice to not be forced to have the WARNING and ERROR log files 
created for you. Some kind of env variable / command line option to enable / 
disable this feature would be good.

Having the extra WARNING and ERROR log files just creates clutter for us.

Also, it would be good to buffer INFO messages and flush them out to the one 
file periodically or as soon as a WARNING or ERROR message is processed for the 
same file. i.e. the buffering is on a per message basis and not applied to the 
whole of the INFO logger.

Original comment by [email protected] on 28 Jun 2010 at 2:11

from google-glog.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
While I agree that this would be preferable, you can arrange this under the 
current system using the public API's by calling

for (google::LogSeverity s = WARNING; s < google::NUM_SEVERITIES; s++)
   google::SetLogDestination(s, "");
google::SetLogDestination(INFO, "/path/to/file");

Then all messages will be logged to only to the file for INFO.

This is a workaround only. but if you are wrapping glog in another layer (like 
I am in my project) then it is probably sufficient.

Rotation should probably be handled externally. To make sure you reopen the 
file you will need to periodically re-call SetLogDestination(INFO, 
"/path/to/file") again so that glog will reopen the file if it has been 
displaced.

Original comment by donald.b.guy on 29 Jun 2010 at 5:41

from google-glog.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
FYI, there is another way to suppress log files.

#include <glog/logging.h>

using namespace google;
using namespace std;

struct NullLogger : public base::Logger {
  virtual void Write(bool should_flush,
                     time_t timestamp,
                     const char* message,
                     int length) {
  }

  virtual void Flush() { }

  virtual uint32 LogSize() { return 0; }
};

void SetMyLogger(int severity, base::Logger* logger) {
  base::Logger* old_logger = base::GetLogger(severity);
  base::SetLogger(severity, logger);
  FlushLogFiles(severity);
}

int main(int argc, char* argv[]) {
  InitGoogleLogging(argv[0]);

  NullLogger null_logger;
  SetMyLogger(WARNING, &null_logger);
  SetMyLogger(ERROR, &null_logger);
  SetMyLogger(FATAL, &null_logger);

  LOG(INFO) << "info";
  LOG(WARNING) << "warn";
  LOG(ERROR) << "error";
  LOG(FATAL) << "fatal";
}

Original comment by [email protected] on 1 Jul 2010 at 6:56

from google-glog.

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.