diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-07-13 15:07:38 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-07-13 15:07:38 +0000 |
commit | 85297aaa9cc2bbc3c6a97984d19d66b542d388ee (patch) | |
tree | 3582db62d9ae9a6e2d255147f9471445eb1128b2 | |
parent | 426375fd6dbbe83b95848e1ba5c15da71770e6be (diff) | |
download | ATCD-85297aaa9cc2bbc3c6a97984d19d66b542d388ee.tar.gz |
ChangeLogTag:Fri Jul 13 09:40:08 2001 Jerry D. De Master <jdemaster@rite-solutions.com>
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 12 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp | 1 | ||||
-rw-r--r-- | ace/Log_Msg.cpp | 13 | ||||
-rw-r--r-- | ace/Log_Msg.h | 2 | ||||
-rw-r--r-- | ace/Log_Msg_UNIX_Syslog.cpp | 14 | ||||
-rw-r--r-- | ace/Logging_Strategy.cpp | 21 | ||||
-rw-r--r-- | ace/Logging_Strategy.h | 5 |
9 files changed, 81 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog index 9c1e4d9ab01..030d5564ed8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Fri Jul 13 09:40:08 2001 Jerry D. De Master <jdemaster@rite-solutions.com> + + * ace/Log_Msg.*, + ace/Logging_Strategy.*, + ace/Log_Msg_UNIX_Syslog.*: + Applied patches to ACE_Log_Msg, ACE_Logging_Strategy, and + ACE_Log_Msg_UNIX_Syslog that are required to add the program + name logging strategy option ('n') and to initialize the UNIX + syslog facility with the program name. Also included are Boris + Kolpackov <bosk@ipmce.ru> patches for ACE_LACKS_IOSTREAM_TOTALLY + to ACE_Logging_Strategy. + Thu Jul 12 19:54:27 2001 Ossama Othman <ossama@uci.edu> * examples/Registry/test_registry_update.cpp (main): diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 9c1e4d9ab01..030d5564ed8 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,15 @@ +Fri Jul 13 09:40:08 2001 Jerry D. De Master <jdemaster@rite-solutions.com> + + * ace/Log_Msg.*, + ace/Logging_Strategy.*, + ace/Log_Msg_UNIX_Syslog.*: + Applied patches to ACE_Log_Msg, ACE_Logging_Strategy, and + ACE_Log_Msg_UNIX_Syslog that are required to add the program + name logging strategy option ('n') and to initialize the UNIX + syslog facility with the program name. Also included are Boris + Kolpackov <bosk@ipmce.ru> patches for ACE_LACKS_IOSTREAM_TOTALLY + to ACE_Logging_Strategy. + Thu Jul 12 19:54:27 2001 Ossama Othman <ossama@uci.edu> * examples/Registry/test_registry_update.cpp (main): diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 9c1e4d9ab01..030d5564ed8 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,15 @@ +Fri Jul 13 09:40:08 2001 Jerry D. De Master <jdemaster@rite-solutions.com> + + * ace/Log_Msg.*, + ace/Logging_Strategy.*, + ace/Log_Msg_UNIX_Syslog.*: + Applied patches to ACE_Log_Msg, ACE_Logging_Strategy, and + ACE_Log_Msg_UNIX_Syslog that are required to add the program + name logging strategy option ('n') and to initialize the UNIX + syslog facility with the program name. Also included are Boris + Kolpackov <bosk@ipmce.ru> patches for ACE_LACKS_IOSTREAM_TOTALLY + to ACE_Logging_Strategy. + Thu Jul 12 19:54:27 2001 Ossama Othman <ossama@uci.edu> * examples/Registry/test_registry_update.cpp (main): diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp index 08778372140..dda4a83a296 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp @@ -1,4 +1,3 @@ - # line 2 "Trader/constraint.y" // $Id$ // ======================================================================== diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index 976d9a0d29b..4fa468e5f45 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -352,6 +352,11 @@ ACE_Log_Msg::disable_debug_messages (ACE_Log_Priority priority) i->priority_mask (i->priority_mask () & ~priority); } +const ACE_TCHAR * +ACE_Log_Msg::program_name (void) +{ + return ACE_Log_Msg::program_name_; +} // Name of the local host. const ACE_TCHAR *ACE_Log_Msg::local_host_ = 0; @@ -663,6 +668,14 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name, -1); } } + else if (ACE_Log_Msg::program_name_ == 0) + { + // Stop heap checking, block will be freed by the destructor. + ACE_NO_HEAP_CHECK; + ACE_ALLOCATOR_RETURN (ACE_Log_Msg::program_name_, + ACE_OS::strdup (ACE_LIB_TEXT ("<unknown>")), + -1); + } int status = 0; diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h index de764e69d71..32627466ad7 100644 --- a/ace/Log_Msg.h +++ b/ace/Log_Msg.h @@ -180,6 +180,8 @@ public: /// Returns non-null if an ACE_Log_Msg exists for the calling thread. static int exists (void); + /// Returns the current program name used for logging. + static const ACE_TCHAR * program_name (void); /// Clears the flag from the default priority mask used to /// initialize ACE_Log_Msg instances. static void disable_debug_messages (ACE_Log_Priority priority = LM_DEBUG); diff --git a/ace/Log_Msg_UNIX_Syslog.cpp b/ace/Log_Msg_UNIX_Syslog.cpp index b933dc1d57e..b82cdc14481 100644 --- a/ace/Log_Msg_UNIX_Syslog.cpp +++ b/ace/Log_Msg_UNIX_Syslog.cpp @@ -30,15 +30,15 @@ ACE_Log_Msg_UNIX_Syslog::~ACE_Log_Msg_UNIX_Syslog (void) } int -ACE_Log_Msg_UNIX_Syslog::open (const ACE_TCHAR * /*logger_key*/) +ACE_Log_Msg_UNIX_Syslog::open (const ACE_TCHAR * logger_key) { - // Initialize the UNIX syslog facility. Default the ID to "ACE", as - // the ACE_DEBUG statement can insert a more unique id in its string - // (via %n). Also, default the syslog options LOG_CONS and LOG_PID. - // These really should be logging strategy options, but we'll take - // the easy way out for now.. + ACE_UNUSED_ARG (logger_key); - openlog (ACE_LIB_TEXT("ACE"), + // Initialize the UNIX syslog facility. Default the syslog log options + // LOG_CONS and LOG_PID to be set. There really should be a logging + // strategy option to control the syslog log options, however, we'll + // take the easy way out for now. + openlog (ACE_Log_Msg::program_name (), LOG_CONS|LOG_PID, ACE_DEFAULT_SYSLOG_FACILITY); diff --git a/ace/Logging_Strategy.cpp b/ace/Logging_Strategy.cpp index c00c82f17d3..8b579680d8e 100644 --- a/ace/Logging_Strategy.cpp +++ b/ace/Logging_Strategy.cpp @@ -121,7 +121,7 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[]) this->interval_ = 0; this->max_size_ = ACE_DEFAULT_MAX_LOGFILE_SIZE; - ACE_Get_Opt get_opt (argc, argv, ACE_LIB_TEXT ("f:i:k:m:p:s:t:wn:o"), 0); + ACE_Get_Opt get_opt (argc, argv, ACE_LIB_TEXT ("f:i:k:m:n:N:op:s:t:w"), 0); for (int c; (c = get_opt ()) != -1; ) { @@ -150,6 +150,10 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[]) this->max_size_ <<= 10; // convert to KB break; case 'n': + delete [] this->program_name_; + this->program_name_ = ACE::strnew (get_opt.optarg); + break; + case 'N': // The max number for the log_file being created this->max_file_number_ = ACE_OS::atoi (get_opt.optarg) - 1; this->fixed_number_ = 1; @@ -209,6 +213,7 @@ ACE_Logging_Strategy::ACE_Logging_Strategy (void) ACE_LIB_TEXT ("logfile")); #endif /* ACE_DEFAULT_LOGFILE */ this->logger_key_ = ACE::strnew (ACE_DEFAULT_LOGGER_KEY); + this->program_name_ = 0; } int @@ -216,6 +221,7 @@ ACE_Logging_Strategy::fini (void) { delete [] this->filename_; delete [] this->logger_key_; + delete [] this->program_name_; return 0; } @@ -299,7 +305,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[]) ACE_Log_Msg::instance ()->set_flags (this->flags_); } - return ACE_LOG_MSG->open (ACE_LIB_TEXT ("Logging_Strategy"), + return ACE_LOG_MSG->open (this->program_name_, ACE_LOG_MSG->flags (), this->logger_key_); } @@ -326,6 +332,7 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &, #if defined (ACE_LACKS_IOSTREAM_TOTALLY) FILE *output_file = (FILE *) ACE_LOG_MSG->msg_ostream (); ACE_OS::fclose (output_file); + // We'll call msg_ostream() modifier later. #else ofstream *output_file = (ofstream *) ACE_LOG_MSG->msg_ostream (); output_file->close (); @@ -342,6 +349,11 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &, // Open a new log file with the same name. #if defined (ACE_LACKS_IOSTREAM_TOTALLY) output_file = ACE_OS::fopen (this->filename_, "wt"); + + if (output_file == 0) + return -1; + + ACE_LOG_MSG->msg_ostream (output_file); #else output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_), ios::out); @@ -429,6 +441,11 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &, // Open a new log file by the same name #if defined (ACE_LACKS_IOSTREAM_TOTALLY) output_file = ACE_OS::fopen (this->filename_, "wt"); + + if (output_file == 0) + return -1; + + ACE_LOG_MSG->msg_ostream (output_file); #else output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_), ios::out); diff --git a/ace/Logging_Strategy.h b/ace/Logging_Strategy.h index 5a0376793a4..e035eaba24e 100644 --- a/ace/Logging_Strategy.h +++ b/ace/Logging_Strategy.h @@ -83,7 +83,8 @@ public: (default is 0, i.e., do not sample by default). '-k' Set the logging key. '-m' Maximum logfile size in Kbytes. - '-n' The maximum number of logfiles that we want created. + '-n' Set the program name for the %n format specifier. + '-N' The maximum number of logfiles that we want created. '-o' Specifies that we want the no standard logfiles ordering (fastest processing in <handle_timeout>). Default is not to order logfiles. @@ -123,6 +124,8 @@ private: /// Logger key for distributed logging. ACE_TCHAR *logger_key_; + /// Program name to be used for %n format specifier. + ACE_TCHAR *program_name_; /// If non-0 then wipeout the logfile, otherwise append to it. /// Default value is 0. |