Issue 125 in google-glog: Reinitialize glog after ShutdownGoogleLogging for unit testing

218 views
Skip to first unread message

codesite...@google.com

unread,
Jun 27, 2012, 10:10:40 AM6/27/12
to googl...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 125 by patrick....@gmail.com: Reinitialize glog after
ShutdownGoogleLogging for unit testing
http://code.google.com/p/google-glog/issues/detail?id=125

What steps will reproduce the problem?
1. InitGoogleLogging()
2. ShutdownGoogleLogging()
3. InitGoogleLogging()

What is the expected output? What do you see instead?
"You called InitGoogleLogging() twice!"

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

Please provide any additional information below.
I could need this functionality to SetUp and TearDown glog on unit test
fixtures (Google Test). I am not sure what Shutdown does?!


codesite...@google.com

unread,
Jul 31, 2012, 4:44:53 PM7/31/12
to googl...@googlegroups.com

Comment #1 on issue 125 by Frej.Soya: Reinitialize glog after
ShutdownGoogleLogging for unit testing
http://code.google.com/p/google-glog/issues/detail?id=125

You can do global setUp and tearDown in google test.

http://code.google.com/p/googletest/wiki/AdvancedGuide#Global_Set-Up_and_Tear-Down

codesite...@google.com

unread,
Aug 29, 2012, 5:26:02 PM8/29/12
to googl...@googlegroups.com

Comment #2 on issue 125 by d.rizzle...@gmail.com: Reinitialize glog after
ShutdownGoogleLogging for unit testing
http://code.google.com/p/google-glog/issues/detail?id=125

The problem is more general, any application that may need to be
reinitialized because it is being run within a larger process scope. I
have run into this issue when running an application that is inside of the
apache web server and needs to reinitialize at the beginning of a request.

Seems like it could be solved by setting g_program_invocation_short_name to
Null inside of void ShutdownGoogleLoggingUtilities() in utilities.cc.

codesite...@google.com

unread,
Aug 29, 2012, 7:57:25 PM8/29/12
to googl...@googlegroups.com

Comment #3 on issue 125 by d.rizzle...@gmail.com: Reinitialize glog after
ShutdownGoogleLogging for unit testing
http://code.google.com/p/google-glog/issues/detail?id=125

This appears to be a duplicate of issue 83.

I was able to solve this for my use case by setting filename to null and
adding a static counter which I include in the filename for cases where the
initializes happen within the same second. There is probably a better
solution but this solved the issues I was having. I attached my diff.

Attachments:
shutdown_patch.diff 1.1 KB

codesite...@google.com

unread,
Aug 29, 2012, 8:35:22 PM8/29/12
to googl...@googlegroups.com

Comment #4 on issue 125 by d.rizzle...@gmail.com: Reinitialize glog after
ShutdownGoogleLogging for unit testing
http://code.google.com/p/google-glog/issues/detail?id=125

This appears to be a duplicate of issue 83.

I was able to solve this for my use case by setting filename to null and
adding a static counter which I include in the filename for cases where the
initializes happen within the same second (only appended if
reinitialized). There is probably a better solution but this solved the
issues I was having. I attached my diff.

Attachments:
shutdown_patch.diff 1.4 KB

codesite...@google.com

unread,
Jan 10, 2013, 2:48:13 AM1/10/13
to googl...@googlegroups.com
Updates:
Status: Fixed

Comment #5 on issue 125 by shinichi...@gmail.com: Reinitialize glog after
ShutdownGoogleLogging for unit testing
http://code.google.com/p/google-glog/issues/detail?id=125

http://code.google.com/p/google-glog/source/detail?r=121

Reply all
Reply to author
Forward
0 new messages