summaryrefslogtreecommitdiff
path: root/netsvcs/lib/Logging_Strategy.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2000-01-17 06:59:41 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2000-01-17 06:59:41 +0000
commit2f0d06a08737b257bcda5c5f3b029f1ce152c2aa (patch)
tree83954b2ea6c616d1a375274ede2f440f10235dbf /netsvcs/lib/Logging_Strategy.cpp
parent62b71a97ce8300c9ac6c2bf1eddcffbead8525d5 (diff)
downloadATCD-2f0d06a08737b257bcda5c5f3b029f1ce152c2aa.tar.gz
ChangeLogTag:Mon Jan 17 00:53:37 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
Diffstat (limited to 'netsvcs/lib/Logging_Strategy.cpp')
-rw-r--r--netsvcs/lib/Logging_Strategy.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/netsvcs/lib/Logging_Strategy.cpp b/netsvcs/lib/Logging_Strategy.cpp
index bc971b5380e..79e2d07e7cd 100644
--- a/netsvcs/lib/Logging_Strategy.cpp
+++ b/netsvcs/lib/Logging_Strategy.cpp
@@ -38,8 +38,9 @@ ACE_Logging_Strategy::parse_args (int argc, char *argv[])
char *temp;
this->flags_ = 0;
+ this->wipeout_logfile_ = 0;
- ACE_Get_Opt get_opt (argc, argv, "f:s:", 0);
+ ACE_Get_Opt get_opt (argc, argv, "f:s:w", 0);
for (int c; (c = get_opt ()) != -1; )
{
@@ -56,6 +57,11 @@ ACE_Logging_Strategy::parse_args (int argc, char *argv[])
ACE_OS::free ((void *) this->filename_);
this->filename_ = ACE_OS::strdup (get_opt.optarg);
break;
+ case 'w':
+ // Cause the logfile to be wiped out, both on startup and on
+ // reconfigure.
+ this->wipeout_logfile_ = 1;
+ break;
default:
break;
}
@@ -98,10 +104,21 @@ ACE_Logging_Strategy::init (int argc, char *argv[])
if (ACE_BIT_ENABLED (this->flags_,
ACE_Log_Msg::OSTREAM))
{
- // Create a new ofstream to direct output to the file
- ofstream *output_file =
- new ofstream (this->filename_);
- ACE_Log_Msg::instance()->msg_ostream (output_file);
+ ofstream *output_file = 0;
+ // Create a new ofstream to direct output to the file.
+ if (wipeout_logfile_)
+ ACE_NEW_RETURN (output_file,
+ ofstream (this->filename_),
+ -1);
+ else
+ ACE_NEW_RETURN (output_file,
+ ofstream (this->filename_,
+ ios::app | ios::out),
+ -1);
+
+ // Set the <output_file> that'll be used by the rest of the
+ // code.
+ ACE_Log_Msg::instance()->msg_ostream (output_file);
}
// Now set the flags for Log_Msg
ACE_Log_Msg::instance()->set_flags (this->flags_);