summaryrefslogtreecommitdiff
path: root/trunk/ACE/examples/APG/Logging/Use_Multiple_Sinks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/ACE/examples/APG/Logging/Use_Multiple_Sinks.cpp')
-rw-r--r--trunk/ACE/examples/APG/Logging/Use_Multiple_Sinks.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/trunk/ACE/examples/APG/Logging/Use_Multiple_Sinks.cpp b/trunk/ACE/examples/APG/Logging/Use_Multiple_Sinks.cpp
new file mode 100644
index 00000000000..352a598b4e2
--- /dev/null
+++ b/trunk/ACE/examples/APG/Logging/Use_Multiple_Sinks.cpp
@@ -0,0 +1,34 @@
+// $Id$
+
+#include "ace/Log_Msg.h"
+#include "ace/streams.h"
+
+int ACE_TMAIN (int, ACE_TCHAR *argv[])
+{
+ // Output to default destination (stderr)
+ ACE_LOG_MSG->open (argv[0]);
+
+ ACE_TRACE ("main");
+
+ ACE_OSTREAM_TYPE *output =
+ (ACE_OSTREAM_TYPE *) new ofstream ("ostream.output.test");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%IThis will go to STDERR\n")));
+
+ ACE_LOG_MSG->open
+ (argv[0], ACE_Log_Msg::SYSLOG, ACE_TEXT ("syslogTest"));
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR);
+ ACE_DEBUG
+ ((LM_DEBUG, ACE_TEXT ("%IThis goes to STDERR & syslog\n")));
+
+ ACE_LOG_MSG->msg_ostream (output, 0);
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%IThis will go to STDERR, ")
+ ACE_TEXT ("syslog & an ostream\n")));
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM);
+ delete output;
+
+ return 0;
+}