diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-10-26 15:07:29 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-10-26 16:43:58 +0200 |
commit | e21ece71a70906526e2c3eceaac3bc0c93bb7831 (patch) | |
tree | 2d2cc50806159a2c735a70c566d3c5e40f3a743e /desktop | |
parent | 5bd0212b54ea8c98fe401e8b1ad6d0b626a4b7e1 (diff) |
unopkg: Make logging to default location work again
Change-Id: Ie0b476164b370f58e0b220cee56ed52896753ade
Reviewed-on: https://gerrit.libreoffice.org/62394
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/deployment/manager/dp_manager.cxx | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 4a010a6ce6e6..d2c33e298199 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -39,6 +39,7 @@ #include <cppuhelper/weakref.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/logging.hxx> #include <comphelper/servicedecl.hxx> #include <comphelper/sequence.hxx> #include <xmlscript/xml_helper.hxx> @@ -47,6 +48,10 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/beans/UnknownPropertyException.hpp> +#include <com/sun/star/logging/LogLevel.hpp> +#include <com/sun/star/logging/FileHandler.hpp> +#include <com/sun/star/logging/SimpleTextFormatter.hpp> +#include <com/sun/star/logging/XLogger.hpp> #include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> @@ -76,6 +81,7 @@ using namespace ::dp_misc; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::logging; namespace dp_log { extern comphelper::service_decl::ServiceDecl const serviceDecl; @@ -353,7 +359,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create( that->m_activePackages = "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages"; that->m_registrationData = "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"; that->m_registryCache = "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/registry"; - logFile = "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/log.txt"; + logFile = "$UNO_USER_PACKAGES_CACHE/log.txt"; //We use the extension .sys for the file because on Windows Vista a sys //(as well as exe and dll) file //will not be written in the VirtualStore. For example if the process has no @@ -371,7 +377,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create( that->m_activePackages = "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/uno_packages"; that->m_registrationData = "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER"; that->m_registryCache = "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/registry"; - logFile = "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/log.txt"; + logFile = "$SHARED_EXTENSIONS_USER/log.txt"; #if !HAVE_FEATURE_READONLY_INSTALLSET // The "shared" extensions are read-only when we have a // read-only installset. @@ -382,7 +388,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create( that->m_activePackages = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS"; that->m_registrationData = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER"; that->m_registryCache = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER/registry"; - logFile = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER/log.txt"; + logFile = "$BUNDLED_EXTENSIONS_USER/log.txt"; //No stamp file. We assume that bundled is always readonly. It must not be //modified from ExtensionManager but only by the installer } @@ -414,6 +420,16 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create( if (!that->m_readOnly && !logFile.isEmpty()) { + // Initialize logger which will be used in ProgressLogImpl (created below) + rtl::Bootstrap::expandMacros(logFile); + comphelper::EventLogger logger(xComponentContext, "unopkg"); + const Reference<XLogger> xLogger(logger.getLogger()); + Reference<XLogFormatter> xLogFormatter(SimpleTextFormatter::create(xComponentContext)); + Sequence < beans::NamedValue > aSeq2 { { "Formatter", Any(xLogFormatter) }, {"FileURL", Any(logFile)} }; + Reference<XLogHandler> xFileHandler(css::logging::FileHandler::createWithSettings(xComponentContext, aSeq2)); + xFileHandler->setLevel(LogLevel::WARNING); + xLogger->addLogHandler(xFileHandler); + const Any any_logFile(logFile); that->m_xLogFile.set( that->m_xComponentContext->getServiceManager() |