using ::com::sun::star::uno::Reference; using ::com::sun::star::logging::XLogger; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using ::com::sun::star::container::XNameContainer; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::uno::XInterface; using ::com::sun::star::util::XChangesBatch; using ::com::sun::star::lang::NullPointerException; using ::com::sun::star::uno::Exception; using ::com::sun::star::lang::ServiceNotRegisteredException; using ::com::sun::star::beans::NamedValue; using ::com::sun::star::logging::XLogHandler; using ::com::sun::star::logging::XLogFormatter; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::uno::XComponentContext;
// read the settings for the to-be-created service
Reference< XNameAccess > xServiceSettingsNode( _rxLoggerSettings->getByName(
OUString::createFromAscii( _pServiceSettingsAsciiNodeName ) ), UNO_QUERY_THROW );
// the default handler, if any
Reference< XInterface > xUntyped( lcl_createInstanceFromSetting_throw( _rContext, _rxLogger, xLoggerSettings, "DefaultHandler", "HandlerSettings", &lcl_transformFileHandlerSettings_nothrow ) ); if ( !xUntyped.is() ) // no handler -> we're done return;
Reference< XLogHandler > xHandler( xUntyped, UNO_QUERY_THROW );
_rxLogger->addLogHandler( xHandler );
// The newly created handler might have an own (default) level. Ensure that it uses // the same level as the logger.
xHandler->setLevel( nLogLevel );
// the default formatter for the handler
xUntyped = lcl_createInstanceFromSetting_throw( _rContext, _rxLogger, xLoggerSettings, "DefaultFormatter", "FormatterSettings" ); if ( !xUntyped.is() ) // no formatter -> we're done return;
Reference< XLogFormatter > xFormatter( xUntyped, UNO_QUERY_THROW );
xHandler->setFormatter( xFormatter );
// TODO: we could first create the formatter, then the handler. This would allow // passing the formatter as value in the component context, so the handler would // not create an own default formatter
} catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("extensions.logging");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.