pombreda / google-glog

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

Reinitialize glog after ShutdownGoogleLogging for unit testing #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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?!

Original issue reported on code.google.com by patrick....@gmail.com on 27 Jun 2012 at 2:10

GoogleCodeExporter commented 9 years ago
You can do global setUp and tearDown in google test.

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

Original comment by Frej.Soya on 31 Jul 2012 at 8:44

GoogleCodeExporter commented 9 years ago
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.

Original comment by d.rizzle...@gmail.com on 29 Aug 2012 at 9:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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.

Original comment by d.rizzle...@gmail.com on 30 Aug 2012 at 12:35

Attachments:

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/google-glog/source/detail?r=121

Original comment by shinichi...@gmail.com on 10 Jan 2013 at 7:47