Implements requested changes.
diff --git a/tensorflow/core/platform/default/logging.cc b/tensorflow/core/platform/default/logging.cc
index fe2bdd4..4b4bcc2 100644
--- a/tensorflow/core/platform/default/logging.cc
+++ b/tensorflow/core/platform/default/logging.cc
@@ -286,6 +286,24 @@
#endif
}
+// A class for managing the text file to which VLOG output is written.
+// If the environment variable TF_CPP_VLOG_FILENAME is set, all VLOG
+// calls are redirected from stderr to a file with corresponding name.
+class VlogFileMgr {
+ public:
+ // Determines if the env variable is set and if necessary
+ // opens the file for write access.
+ VlogFileMgr();
+ // Closes the file.
+ ~VlogFileMgr();
+ // Returns either a pointer to the file or stderr.
+ FILE* FilePtr() const;
+
+ private:
+ FILE* vlog_file_ptr;
+ char* vlog_file_name;
+};
+
VlogFileMgr::VlogFileMgr() {
vlog_file_name = getenv("TF_CPP_VLOG_FILENAME");
vlog_file_ptr =
@@ -512,7 +530,7 @@
abort();
}
#else // PLATFORM_POSIX_ANDROID
- static internal::VlogFileMgr vlog_file;
+ static const internal::VlogFileMgr vlog_file;
static bool log_thread_id = internal::EmitThreadIdFromEnv();
uint64 now_micros = EnvTime::NowMicros();
time_t now_seconds = static_cast<time_t>(now_micros / 1000000);
@@ -552,9 +570,6 @@
break;
}
- // TODO(jeff,sanjay): Replace this with something that logs through the env.
- mutex mu;
- mutex_lock l(mu);
fprintf(vlog_file.FilePtr(), "%s.%06d: %c%s %s:%d] %s\n", time_buffer,
micros_remainder, sev, tid_buffer, entry.FName().c_str(),
entry.Line(), entry.ToString().c_str());
diff --git a/tensorflow/core/platform/default/logging.h b/tensorflow/core/platform/default/logging.h
index 8270096..27331b2 100644
--- a/tensorflow/core/platform/default/logging.h
+++ b/tensorflow/core/platform/default/logging.h
@@ -470,24 +470,6 @@
int64 MaxVLogLevelFromEnv();
-// A class for managing the text file to which VLOG output is written.
-// If the environment variable TF_CPP_VLOG_FILENAME is set, all VLOG
-// calls are redirected from stderr to a file with corresponding name.
-class VlogFileMgr {
- public:
- // Determines if the env variable is set and if necessary
- // opens the file for write access.
- VlogFileMgr();
- // Closes the file.
- ~VlogFileMgr();
- // Returns either a pointer to the file or stderr.
- FILE* FilePtr() const;
-
- private:
- FILE* vlog_file_ptr;
- char* vlog_file_name;
-};
-
} // namespace internal
// LogSink support adapted from //base/logging.h