2 #include "ace/Log_Msg.h"
3 #include "ace/Log_Msg_Backend.h"
4 #include "ace/Log_Record.h"
6 const ACE_TCHAR
* mykey
= ACE_TEXT("KEY");
8 class Backend
: public ACE_Log_Msg_Backend
14 virtual int open (const ACE_TCHAR
*logger_key
);
20 virtual ssize_t
log (ACE_Log_Record
&log_record
);
29 Backend::open (const ACE_TCHAR
*key
)
31 if (ACE_OS::strcmp (key
, mykey
) == 0)
49 Backend::log (ACE_Log_Record
&)
60 int ACE_TMAIN (int, ACE_TCHAR
*argv
[])
63 ACE_Log_Msg_Backend
*old_b
= ACE_Log_Msg::msg_backend (&b
);
65 ACE_LOG_MSG
->set_flags (ACE_Log_Msg::CUSTOM
);
67 ACE_TCHAR
*my_argv
[3];
69 my_argv
[1] = const_cast<ACE_TCHAR
*> (ACE_TEXT ("-ORBServiceConfigLoggerKey"));
70 my_argv
[2] = const_cast<ACE_TCHAR
*> (mykey
);
73 CORBA::ORB_var orb2_
= CORBA::ORB_init (my_argc
, my_argv
, "ServerORB1");
77 ACE_ERROR_RETURN ((LM_ERROR
, "ERROR: Key not ok!\n"), 1);
80 // Reset the backend to avoid references to our soon-to-be-destroyed one.
81 ACE_Log_Msg::msg_backend (old_b
);