Example #1
0
void
ServantPluginImpl::init_debug_adbroker( Broker::Manager_var& mgr )
{
	manager_ = mgr;

	if ( ! CORBA::is_nil( manager_ ) ) {

        try {
            Broker::Session_var broker = manager_->getSession( L"debug" );
            if ( ! CORBA::is_nil( broker ) ) 
                broker->connect( "user", "pass", "debug", 0 );
        } catch ( CORBA::Exception& ex ) {
            adportable::debug(__FILE__, __LINE__) << ex._info().c_str();
            return;
        }
        
		connect( this, SIGNAL( signal_notify_update( unsigned long ) )
                 , this, SLOT( handle_notify_update( unsigned long ) ) );
        
		Broker::Logger_var logger = manager_->getLogger();

		if ( ! CORBA::is_nil( logger.in() ) ) {
			logger->register_handler( logHandler_._this() );

			Broker::LogMessage msg;
            msg.tv_sec = msg.tv_usec = 0;
			msg.text = L"init_abroker initialized";
			logger->log( msg );
		}
	}
}
Example #2
0
void
Logging::commit_to_broker()
{
    const EventLog::LogMessage& elog = msg.get();
    if ( elog.format.in() && *elog.format.in() != 0 ) {
        Broker::Logger_var logger = static_cast< manager_i *>(*manager_i::instance())->getLogger();
        if ( ! CORBA::is_nil( logger ) ) {
            Broker::LogMessage blog;
            blog.logId = elog.logId;
            blog.priority = elog.priority;
            blog.tv_sec = elog.tv.sec;
            blog.tv_usec = elog.tv.usec;
            blog.msgId = CORBA::wstring_dup( elog.msgId );
            blog.srcId = CORBA::wstring_dup( elog.srcId );
            blog.text = CORBA::wstring_dup( elog.format );
            blog.args.length( elog.args.length() );
            for ( size_t i = 0; i < elog.args.length(); ++i )
                blog.args[i] = CORBA::wstring_dup( elog.args[i] );
            logger->log( blog );
        }
    }
}