diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-01-29 23:39:24 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-01-29 23:39:24 +0000 |
commit | f3c76488a5635fa437a5100de5e93cf9d382714a (patch) | |
tree | 05f2f8b856a808ba1686ee99257a8f9ac6bfdf55 | |
parent | b99ce913aa47ce04506fa6681331590a8bd54612 (diff) | |
download | ATCD-f3c76488a5635fa437a5100de5e93cf9d382714a.tar.gz |
Allow closing the logger's connection and reset logging endpoint to STDERR.
-rw-r--r-- | ace/Log_Msg.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index 891ceef574b..9414f32f95e 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -470,6 +470,10 @@ ACE_Log_Msg::open (const char *prog_name, int status = 0; + // Always close the current handle before doing anything else. + if (ACE_Log_Msg_message_queue->get_handle () != ACE_INVALID_HANDLE) + ACE_Log_Msg_message_queue->close (); + // Note that if we fail to open the message queue the default action // is to use stderr (set via static initialization in the // ACE_Log_Msg.C file). @@ -480,9 +484,6 @@ ACE_Log_Msg::open (const char *prog_name, status = -1; else { - if (ACE_Log_Msg_message_queue->get_handle () != ACE_INVALID_HANDLE) - ACE_Log_Msg_message_queue->close (); - ACE_LOG_MSG_IPC_CONNECTOR con; status = con.connect (*ACE_Log_Msg_message_queue, ACE_LOG_MSG_IPC_ADDR (ACE_MULTIBYTE_STRING (logger_key))); @@ -493,6 +494,12 @@ ACE_Log_Msg::open (const char *prog_name, else ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER); } + else if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER)) + { + // If we are closing down logger, redirect logging to stderr. + ACE_CLR_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER); + ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR); + } // Remember, ACE_Log_Msg::STDERR bit is on by default... if (status != -1 |