zhangjl / google-glog

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

Question: how to specify logging filenames? #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A question not a issue:

glog.html says that: "Unless otherwise specified, glog writes to the filename 
"/tmp/<program name>.<hostname>.<user name>.log.<severity 
level>.<date>.<time>.<pid>" (e.g., ..."

But how to specify it?

Thank you.

Original issue reported on code.google.com by jjcao1...@gmail.com on 8 Jan 2010 at 9:40

GoogleCodeExporter commented 9 years ago
If you want to change the destination directory, you can use --log_dir (or 
GLOG_log_dir if you don't have gflags installed). If you want to change the 
name of 
log files, you may need to call SetLogDestination():

  google::SetLogDestination(google::INFO, "/var/tmp/another_destination.INFO");

Original comment by shinichi...@gmail.com on 12 Jan 2010 at 8:29

GoogleCodeExporter commented 9 years ago
I don't know how to use --GLOG_log_dir. But SetLogDestination() works.
Thank you.

Original comment by jjcao1...@gmail.com on 12 Jan 2010 at 9:04

GoogleCodeExporter commented 9 years ago
One can also try setting the GOOGLE_LOG_DIR environment variable to point to a
directory of choice.

Original comment by pradeep....@gmail.com on 27 Apr 2010 at 12:46

GoogleCodeExporter commented 9 years ago
Is it safe to direct different log levels to the same log file in a 
multithreaded 
application?

google::SetLogDestination(google::INFO, "/var/tmp/applog.log");
google::SetLogDestination(google::WARNING, "/var/tmp/applog.log");
google::SetLogDestination(google::ERROR, "/var/tmp/applog.log");

Thanks!

Original comment by Haiyao...@gmail.com on 19 May 2010 at 1:32

GoogleCodeExporter commented 9 years ago
Actually, while trying to set to the same log file as mentioned above, I got 
runtime 
error as the following...

Could not create log file: File exists
COULD NOT CREATE LOGFILE '20100519-094242.22838'!

The reason I want to put them in the the same file is that I want to check the 
events sequence according to the timestamps.

Original comment by Haiyao...@gmail.com on 19 May 2010 at 1:50

GoogleCodeExporter commented 9 years ago
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 shinichi...@gmail.com on 19 May 2010 at 2:39

GoogleCodeExporter commented 9 years ago
Yes, that is good enough. I did not read carefully.
Now while I am reading the INFO log carefully I do see Warnings and Errors.

Thanks and keep up the good work!

Original comment by Haiyao...@gmail.com on 19 May 2010 at 9:13

GoogleCodeExporter commented 9 years ago

Original comment by shinichi...@gmail.com on 27 May 2010 at 9:10

GoogleCodeExporter commented 9 years ago
I really appreciate the smart robust and clean glog library.
I was fed up with the issues other c++ logging libraries.
I will would have been much happier if you guys would have given the better 
documentation.

Original comment by s.raj0...@gmail.com on 17 Sep 2010 at 11:47