summaryrefslogtreecommitdiff
path: root/sal/osl/unx/salinit.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl/unx/salinit.cxx')
-rw-r--r--sal/osl/unx/salinit.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sal/osl/unx/salinit.cxx b/sal/osl/unx/salinit.cxx
index d880258f387e..4211d081ad7e 100644
--- a/sal/osl/unx/salinit.cxx
+++ b/sal/osl/unx/salinit.cxx
@@ -29,6 +29,13 @@
#include "sal/main.h"
#include "sal/types.h"
+#ifdef HAVE_SYSLOG_H
+#include <string.h>
+#include <syslog.h>
+// from sal/osl/all/log.cxx:
+extern bool sal_use_syslog;
+#endif
+
extern "C" {
void sal_detail_initialize(int argc, char ** argv) {
@@ -57,6 +64,12 @@ void sal_detail_initialize(int argc, char ** argv) {
close(fd);
}
#endif
+#ifdef HAVE_SYSLOG_H
+ const char *use_syslog = getenv("SAL_LOG_SYSLOG");
+ sal_use_syslog = use_syslog != NULL && !strcmp(use_syslog, "1");
+ if (sal_use_syslog)
+ openlog("libreoffice", 0, LOG_USER);
+#endif
osl_setCommandArgs(argc, argv);
}