jren2012 / google-glog

Automatically exported from code.google.com/p/google-glog
0 stars 0 forks source link

Check failure stack trace #86

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. LOG(FATAL) << "fatal";  <---- program down
2.
3.

What is the expected output? What do you see instead?
Check failure stack trace Message and application down..

What version of the product are you using? On what operating system?

Visual Stdio 2010
window 7

Please provide any additional information below.

#include "stdafx.h"
#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 _tmain(int argc, _TCHAR* argv[])
{

  InitGoogleLogging(argv[0]);

  NullLogger null_logger;

  SetLogDestination(INFO, "c:\\temp\\aa.log"); 

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

  LOG(INFO) << "info";
  LOG(WARNING) << "warn";
  LOG(ERROR) << "error1";
  LOG(ERROR) << "error2";
  LOG(ERROR) << "error3";
  LOG(FATAL) << "fatal";  // <------ Check failure stack trace Messgae
                          //  and Program down

  LOG(WARNING) << "warn";
  LOG(WARNING) << "warn1";

    return 0;

}

Original issue reported on code.google.com by ctm...@gmail.com on 13 Apr 2011 at 2:06