• R/O
  • SSH
  • HTTPS

wrapper: Commit


Commit MetaInfo

Revision456 (tree)
Time2020-12-08 17:41:12
Authormaxime-tsl

Log Message

Work on 3.5.45

Change Summary

Incremental Difference

--- trunk/wrapper/build.xml (revision 455)
+++ trunk/wrapper/build.xml (revision 456)
@@ -251,6 +251,11 @@
251251 <property name="releaseSymbolsFile" value="${releasefile}-SYMBOLS"/>
252252 </target>
253253 <target name="init-windows" depends="init-setup" if="is.windows">
254+ <fail message="Windows 64-bits is not supported." >
255+ <condition>
256+ <equals arg1="${bits}" arg2="64"/>
257+ </condition>
258+ </fail>
254259 <!-- Decide on the type of script to generate. -->
255260 <property name="is.shell.bat" value="true"/>
256261
@@ -572,7 +577,8 @@
572577 </javah>
573578 </target>
574579 <target name="compile-java:javac-no-javah" depends="compile-java:setup" unless="is.javah_supported">
575- <!-- From Java 8 is recommended not to use javah to generate JNI headers, from Java 10 it is no longer possible and javac -h must be used. -->
580+ <!-- From Java 8 is recommended not to use javah to generate JNI headers, from Java 10 it is no longer possible and javac -h must be used.
581+ The 'nativeheaderdir' attribute was introduced in Ant 1.9.8. -->
576582 <echo message="White headers to ${build.headers}"/>
577583 <javac srcdir="${src.dir}/java"
578584 destdir="${build.classes}"
@@ -748,7 +754,7 @@
748754 </target>
749755 <target name="compile-c" depends="compile-c-windows-check2,compile-c-unix">
750756 </target>
751- <target name="compile" depends="compile-java, compile-c"
757+ <target name="compile" depends="compile-java, jar, compile-c"
752758 description="Compiles all java and c source">
753759
754760 <mkdir dir="${logs.dir}"/>
@@ -771,7 +777,9 @@
771777 </copy>
772778 </target>
773779 <target name="jar:build" depends="init-setup" unless="prebuilt.jar.present">
780+ <echo message="&gt; antcall compile-java"/>
774781 <antcall target="compile-java" />
782+ <echo message="&lt; antcall compile-java"/>
775783
776784 <jar jarfile="${lib.dir}/wrapper.jar"
777785 basedir="${build.classes}"
@@ -906,11 +914,6 @@
906914 <jar-check-signature filename="wrapperdemo.jar" />
907915 </target>
908916 <target name="jar" depends="jar:get"/>
909-
910- <!-- Removes the src/pre-release directory -->
911- <target name="jar:clean-src-pre-release">
912- <delete dir="${src.dir}/pre-release"/>
913- </target>
914917
915918 <!-- =================================================================== -->
916919 <!-- Test Task -->
@@ -1275,6 +1278,7 @@
12751278 <include name="project.dtd" />
12761279 <include name="lib/wrapper.jar" />
12771280 <include name="lib/wrappertest.jar" />
1281+ <include name="lib/wrappertest2.jar" />
12781282 <include name="lib/wrapperdemo.jar" />
12791283 <include name="doc/**" />
12801284 <include name="src/bin/**" />
@@ -1414,9 +1418,11 @@
14141418 <mkdir dir="${releasedir}"/>
14151419 <mkdir dir="${releasedir}/bin"/>
14161420
1421+ <echo message="&gt; antcall bin"/>
14171422 <antcall target="bin" inheritall="false">
14181423 <param name="bin.dir" value="${releasedir}/bin"/>
14191424 </antcall>
1425+ <echo message="&lt; antcall bin"/>
14201426
14211427 <mkdir dir="${dist.dir}"/>
14221428 <copy todir="${releasedir}" >
@@ -1534,9 +1540,11 @@
15341540 <mkdir dir="${releasedir}"/>
15351541 <mkdir dir="${releasedir}/bin"/>
15361542
1543+ <echo message="&gt; antcall bin"/>
15371544 <antcall target="bin" inheritall="false">
15381545 <param name="bin.dir" value="${releasedir}/bin"/>
15391546 </antcall>
1547+ <echo message="&lt; antcall bin"/>
15401548
15411549 <mkdir dir="${dist.dir}"/>
15421550 <copy todir="${releasedir}" >
@@ -1560,7 +1568,9 @@
15601568 </copy>
15611569
15621570 <!-- Strip symbols from the binaries. This needs to be done before any signatures are made. -->
1571+ <echo message="&gt; antcall release-unix:strip-symbols"/>
15631572 <antcall target="release-unix:strip-symbols"/>
1573+ <echo message="&lt; antcall release-unix:strip-symbols"/>
15641574
15651575 <!-- Copy a fresh wrapper.conf rather than the development file -->
15661576 <copy file="${src.dir}/conf/wrapper.conf.in"
@@ -1618,7 +1628,11 @@
16181628 </copy>
16191629 <fixcrlf srcdir="${releasedir}" encoding="UTF-8" outputencoding="UTF-8" includes="README_*.txt" eol="lf"/>
16201630
1621- <!--<antcall target="release-unix:check-consistency"/> -->
1631+ <!--
1632+ <echo message="&gt; antcall release-unix:check-consistency"/>
1633+ <antcall target="release-unix:check-consistency"/>
1634+ <echo message="&lt; antcall release-unix:check-consistency"/>
1635+ -->
16221636
16231637 <tar tarfile="${build.dir}/${releasefile}.tar">
16241638 <tarfileset dir="${build.dir}" mode="755">
@@ -1826,6 +1840,7 @@
18261840 <attribute name="wrapperlibtail"/>
18271841 <attribute name="archivetype"/>
18281842 <sequential>
1843+ <echo message="&gt; antcall release-delta:extract-platform"/>
18291844 <antcall target="release-delta:extract-platform">
18301845 <param name="d-osname" value="@{osname}"/>
18311846 <param name="d-osarch" value="@{osarch}"/>
@@ -1836,6 +1851,7 @@
18361851 <param name="d-wrapperlibtail" value="@{wrapperlibtail}"/>
18371852 <param name="d-archivetype" value="@{archivetype}"/>
18381853 </antcall>
1854+ <echo message="&lt; antcall release-delta:extract-platform"/>
18391855 </sequential>
18401856 </macrodef>
18411857 <target name="release-delta:extract-platforms">
@@ -1873,14 +1889,19 @@
18731889 <mkdir dir="${releasedir}"/>
18741890 <mkdir dir="${releasedir}/bin"/>
18751891
1892+ <echo message="&gt; antcall bin"/>
18761893 <antcall target="bin" inheritall="false">
18771894 <param name="bin.dir" value="${releasedir}/bin"/>
18781895 <param name="is.shell.bat" value="true"/>
18791896 </antcall>
1897+ <echo message="&lt; antcall bin"/>
1898+
1899+ <echo message="&gt; antcall bin"/>
18801900 <antcall target="bin" inheritall="false">
18811901 <param name="bin.dir" value="${releasedir}/bin"/>
18821902 <param name="is.shell.sh" value="true"/>
18831903 </antcall>
1904+ <echo message="&lt; antcall bin"/>
18841905
18851906 <copy todir="${releasedir}">
18861907 <fileset dir="${basedir}">
@@ -2031,7 +2052,7 @@
20312052 <!-- Release -->
20322053 <!-- =================================================================== -->
20332054 <target name="release"
2034- depends="test-setup, bin, conf, release-windows, release-unix"
2055+ depends="bin, conf, test-setup, release-windows, release-unix"
20352056 description="Builds all release files for the current platform">
20362057 </target>
20372058
@@ -2089,6 +2110,7 @@
20892110
20902111 <delete file="${lib.dir}/wrapper.jar"/>
20912112 <delete file="${lib.dir}/wrappertest.jar"/>
2113+ <delete file="${lib.dir}/wrappertest2.jar"/>
20922114 <delete file="${lib.dir}/wrapperdemo.jar"/>
20932115
20942116 <!-- Windows -->
--- trunk/wrapper/doc/revisions.txt (revision 455)
+++ trunk/wrapper/doc/revisions.txt (revision 456)
@@ -3,20 +3,20 @@
33 3.5.45
44 * Fix a problem where Windows binaries were not being signed correctly in the
55 3.5.44 release. Added additional checks.
6-* Fix an issue when using wrapper.timezone. If the file named 'etcetera',
7- provided by the IANA tz database, was present at the location specified by
8- wrapper.timezone.folder, the Wrapper failed to parse it and got blocked on
9- startup. Removing this file would solve the issue.
6+* Fix a parsing error causing the Wrapper to hang on startup if the file
7+ 'etcetera' (part of the IANA tz database) was present at the location
8+ specified by wrapper.timezone.folder. Removing this file would solve the
9+ issue.
1010 * Fix a problem where the Wrapper would fail to start if the shell script was
1111 on a path which contained multiple consecutive spaces. (Bug #311)
12-* When building tests (Community Edition), check the presence of a javascript
13- engine instead of assuming it is available based on the Java version. If no
12+* When building tests (Community Edition), check the presence of a Javascript
13+ engine instead of assuming its availability based on the Java version. If no
1414 built-in engine is found, an external engine can be specified by setting the
1515 'external.js.engine.dir' property when calling Ant. (Bug #313)
1616 * Add a new _WRAPPER_TIMEOUT setting in the Windows batch scripts which makes
1717 it possible to control the maximum number of seconds to pause on exit when
1818 there is a problem. (Feature #136)
19-* Makes it possible to build the Community Edition with with Java 10+ by
19+* Make it possible to build the Community Edition with Java 10+ by
2020 automatically using 'javac -h' instead of 'javah'. (Bug #312)
2121 * Use the value of javac.target.version in default.properties (Ant file) as the
2222 minimum version of Java supported by the Wrapper instead of a hard-coded
@@ -27,9 +27,27 @@
2727 * Fix a problem where the Wrapper would show an error on startup if the stdin
2828 pipe was not tied to a console window. This can happen when called within
2929 other programs. Since 3.5.43.
30-* Modify the DemoApp so its internal Wrapper instances no longer log to the
31- mail wrapper.log file as that was causing confusion. Fix an NPE in the
30+* Modify the DemoApp so its internal Wrapper instance no longer logs to the
31+ main wrapper.log file as that was causing confusion. Fix an NPE in the
3232 DemoApp if the Wrapper was shutdown external to the DemoApp dialog.
33+* Fix a log rolling issue if the current log file was manually deleted or if it
34+ did not exist because the logging was temporarily turned off. The WRAPPER,
35+ JVM, SIZE_OR_WRAPPER, SIZE_OR_JVM modes were still rolling the old files and
36+ the most recent one ended up having a roll number of "2". Now the rolling
37+ occurs only when a log file without roll number exists.
38+* Fix an issue where some early messages were logged before the log file was
39+ being rolled on startup.
40+* Fix duplicate messages generated while loading the configuration: when the
41+ path to the configuration file or the working directory can't be resolved,
42+ when the Wrapper is elevated to control a Windows Service, or in some cases
43+ when properties are not set correctly.
44+* Fix an issue where the pid file was wrongly detected as stale and removed by
45+ the Shell Script on some Linux systems. This was happening when the path to
46+ the working directory exceeded a certain amount of characters.
47+* Make it possible to query permissions of a service with WrapperW. The output
48+ will be displayed in the dialog window.
49+* Print the path of the log file when the Wrapper is launched from the Shell
50+ Script and fails to start.
3351 * The z/Linux distributions are now built on a IBM z14 machine with RedHat
3452 Linux 7.8.
3553
--- trunk/wrapper/src/bin/App.sh.in (revision 455)
+++ trunk/wrapper/src/bin/App.sh.in (revision 456)
@@ -1201,6 +1201,9 @@
12011201 TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT`
12021202 pidtest=`$PS_BIN -p $pid -o args | grep -F "$TRUNCATED_CMD" | tail -1`
12031203 ;;
1204+ 'linux')
1205+ pidtest=`$PS_BIN -ww -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1`
1206+ ;;
12041207 *)
12051208 pidtest=`$PS_BIN -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1`
12061209 ;;
@@ -1383,7 +1386,20 @@
13831386 done
13841387 echo ""
13851388 }
1386-
1389+
1390+##
1391+# Request the path to the log file to the Wrapper and print it
1392+#
1393+# $1 prefix
1394+printlogfilepath() {
1395+ LOG_FILE=`"$WRAPPER_CMD" --request_log_file "$WRAPPER_CONF"`
1396+ if [ $? = 0 -a "X$LOG_FILE" != "X" ] ; then
1397+ LOG_FILE_MSG=`gettext 'See \"${LOG_FILE}\" for details.'` # translate
1398+ LOG_FILE_MSG=`eval echo "${LOG_FILE_MSG}"` # expand ${LOG_FILE}
1399+ echo "$1${LOG_FILE_MSG}" # print with indentation
1400+ fi
1401+}
1402+
13871403 startwait() {
13881404 if [ $WAIT_FOR_STARTED_STATUS = true ]
13891405 then
@@ -1404,7 +1420,8 @@
14041420 getpid
14051421 if [ "X$pid" = "X" ]
14061422 then
1407- eval echo `gettext ' WARNING: $APP_LONG_NAME may have failed to start.'`
1423+ eval echo `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`
1424+ printlogfilepath " "
14081425 exit 1
14091426 else
14101427 eval echo `gettext ' running: PID:$pid'`
@@ -1688,6 +1705,7 @@
16881705 systemctl start $APP_NAME
16891706 if [ $? -ne 0 ] ; then
16901707 eval echo `gettext 'Failed to start $APP_LONG_NAME.'`
1708+ printlogfilepath
16911709 exit 1
16921710 fi
16931711
@@ -1717,6 +1735,7 @@
17171735 systemctl restart $APP_NAME
17181736 if [ $? -ne 0 ] ; then
17191737 eval echo `gettext 'Failed to restart service $APP_NAME'`
1738+ printlogfilepath
17201739 exit 1
17211740 fi
17221741
@@ -1772,6 +1791,7 @@
17721791 startsrc -s "${APP_NAME}"
17731792 if [ $? -ne 0 ] ; then
17741793 eval echo `gettext 'Failed to start $APP_LONG_NAME.'`
1794+ printlogfilepath
17751795 exit 1
17761796 fi
17771797
--- trunk/wrapper/src/c/logger.c (revision 455)
+++ trunk/wrapper/src/c/logger.c (revision 456)
@@ -3708,7 +3708,6 @@
37083708 uptimeFlipped = flipped;
37093709 }
37103710
3711-int rollFailure = FALSE;
37123711 /**
37133712 * Rolls log files using the ROLLNUM system.
37143713 *
@@ -3716,6 +3715,7 @@
37163715 * If NULL, the current date will be used.
37173716 */
37183717 void rollLogs(const TCHAR *nowStr) {
3718+ static int failureLogged = FALSE;
37193719 int i;
37203720 TCHAR rollNum[11];
37213721 #if defined(WIN32) && !defined(WIN64)
@@ -3765,10 +3765,17 @@
37653765 fclose(logfileFP);
37663766 logfileFP = NULL;
37673767 currentLogFileName[0] = TEXT('\0');
3768+ } else {
3769+ /* Don't roll if the current log file doesn't exist or can't be accessed. */
3770+ generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL);
3771+ if (_tstat(currentLogFileName, &fileStat) != 0) {
3772+ currentLogFileName[0] = TEXT('\0');
3773+ return;
3774+ }
37683775 }
37693776
37703777 #ifdef _DEBUG
3771- _tprintf(TEXT("Rolling log files... (rollFailure=%d)\n"), rollFailure);
3778+ _tprintf(TEXT("Rolling log files... (failureLogged=%d)\n"), failureLogged);
37723779 #endif
37733780
37743781 /* We don't know how many log files need to be rotated yet, so look. */
@@ -3807,10 +3814,10 @@
38073814 } else if (getLastError() == 3) {
38083815 /* The path did not exist. */
38093816 } else {
3810- if (rollFailure == FALSE) {
3817+ if (!failureLogged) {
38113818 log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to delete old log file: %s (%s)"), workLogFileName, getLastErrorText());
3819+ failureLogged = TRUE;
38123820 }
3813- rollFailure = TRUE;
38143821 generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
38153822 return;
38163823 }
@@ -3821,10 +3828,10 @@
38213828 #ifdef _DEBUG
38223829 _tprintf(TEXT("Failed to remove old log file %s\n"), workLogFileName);
38233830 #endif
3824- if (rollFailure == FALSE) {
3831+ if (!failureLogged) {
38253832 log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to delete old log file: %s"), workLogFileName);
3833+ failureLogged = TRUE;
38263834 }
3827- rollFailure = TRUE;
38283835 generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
38293836 return;
38303837 }
@@ -3836,7 +3843,7 @@
38363843 }
38373844 } else {
38383845 if (_trename(workLogFileName, currentLogFileName) != 0) {
3839- if (rollFailure == FALSE) {
3846+ if (!failureLogged) {
38403847 #ifdef WIN32
38413848 if (errno == EACCES) {
38423849 /* This access denied message is treated as a special case, but the use by other applications issue only happens on Windows. */
@@ -3851,8 +3858,8 @@
38513858 #ifdef WIN32
38523859 }
38533860 #endif
3861+ failureLogged = TRUE;
38543862 }
3855- rollFailure = TRUE;
38563863 generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
38573864 return;
38583865 }
@@ -3867,7 +3874,7 @@
38673874 /* Rename the current file to the #1 index position */
38683875 generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL);
38693876 if (_trename(currentLogFileName, workLogFileName) != 0) {
3870- if (rollFailure == FALSE) {
3877+ if (!failureLogged) {
38713878 if (getLastError() == 2) {
38723879 /* File does not yet exist. */
38733880 } else if (getLastError() == 3) {
@@ -3882,8 +3889,8 @@
38823889 log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to rename log file %s to %s. (%s)"),
38833890 currentLogFileName, workLogFileName, getLastErrorText());
38843891 }
3892+ failureLogged = TRUE;
38853893 }
3886- rollFailure = TRUE;
38873894 generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
38883895 return;
38893896 }
@@ -3899,12 +3906,12 @@
38993906 limitLogFileCount(currentLogFileName, logFilePurgePattern, logFilePurgeSortMode, logFileMaxLogFiles + 1);
39003907 }
39013908 }
3902- if (rollFailure == TRUE) {
3903- /* We made it here, but the rollFailure flag had been previously set. Make a note that we are back and then continue. */
3909+ if (failureLogged) {
3910+ /* We made it here, but the failureLogged flag had been previously set. Make a note that we are back and then continue. */
39043911 log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG,
39053912 TEXT("Logfile rolling is working again."));
3913+ failureLogged = FALSE;
39063914 }
3907- rollFailure = FALSE;
39083915
39093916 /* Reset the current log file name as it is not being used yet. */
39103917 currentLogFileName[0] = TEXT('\0'); /* Log file was rolled, so we want to cause a logfile change event. */
--- trunk/wrapper/src/c/property.c (revision 455)
+++ trunk/wrapper/src/c/property.c (revision 456)
@@ -676,6 +676,7 @@
676676 properties->ignoreVarMap = newHashMap(8);
677677 properties->dumpFormat = NULL;
678678 if ((!properties->warnedVarMap) || (!properties->ignoreVarMap)) {
679+ outOfMemory(TEXT("CP"), 2);
679680 disposeProperties(properties);
680681 return NULL;
681682 }
--- trunk/wrapper/src/c/property.h (revision 455)
+++ trunk/wrapper/src/c/property.h (revision 456)
@@ -86,7 +86,7 @@
8686 struct Properties {
8787 int debugProperties; /* TRUE if debug information on Properties should be shown. */
8888 int exitOnOverwrite; /* If TRUE, causes the wrapper to exit when any property is overwritten in the config files. */
89- int logLevelOnOverwrite; /* Defines the log level of the messages reported when properties are overwritten. */
89+ int logLevelOnOverwrite; /* Defines the log level of the messages reported when properties are overwritten (the value may change each time a directive is encountered as the configuration is loading). */
9090 int overwrittenPropertyCausedExit; /* Flag to keep trace whether at least one property was overridden */
9191 int logWarnings; /* Flag that controls whether or not warnings will be logged. */
9292 int logWarningLogLevel; /* Log level at which any log warnings will be logged. */
--- trunk/wrapper/src/c/wrapper.c (revision 455)
+++ trunk/wrapper/src/c/wrapper.c (revision 456)
@@ -676,7 +676,7 @@
676676 #endif
677677
678678 /**
679- * Return TRUE if the this is a prompt call made from the script (like --translate or --jvm_bits or --request_delta_binary_bits).
679+ * Return TRUE if the this is a prompt call made from the script (like --translate or --jvm_bits or --request_delta_binary_bits or --request_log_file).
680680 *
681681 * @param argCommand the first arguement passed when launching the Wrapper
682682 */
@@ -686,11 +686,14 @@
686686 }
687687 return ((strcmpIgnoreCase(argCommand, TEXT("-translate")) == 0) ||
688688 (strcmpIgnoreCase(argCommand, TEXT("-jvm_bits")) == 0) ||
689+#ifndef WIN32
690+ (strcmpIgnoreCase(argCommand, TEXT("-request_log_file")) == 0) ||
691+#endif
689692 (strcmpIgnoreCase(argCommand, TEXT("-request_delta_binary_bits")) == 0));
690693 }
691694
692695 /**
693- * Return TRUE if the this is a prompt call made from the script (like --translate or --jvm_bits or --request_delta_binary_bits).
696+ * Return TRUE if the this is a prompt call made from the script (like --translate or --jvm_bits or --request_delta_binary_bits or --request_log_file).
694697 * This function must be called after the arguments have been parsed!
695698 */
696699 int isPromptCall() {
@@ -752,11 +755,23 @@
752755 }
753756 setLogfileRollMode(logfileRollMode);
754757
758+ if (preload) {
759+ if (!strcmpIgnoreCase(wrapperData->argCommand, TEXT("c")) || !strcmpIgnoreCase(wrapperData->argCommand, TEXT("-console")) ||
760+ !strcmpIgnoreCase(wrapperData->argCommand, TEXT("s")) || !strcmpIgnoreCase(wrapperData->argCommand, TEXT("-service"))) {
761+ /* See if the logs should be rolled on Wrapper startup (console and service only).
762+ * This is done once during preload so that there is no output before the file is being rolled. */
763+ if ((getLogfileRollMode() & ROLL_MODE_WRAPPER) ||
764+ (getLogfileRollMode() & ROLL_MODE_JVM)) {
765+ rollLogs(NULL);
766+ }
767+ }
768+ }
769+
755770 /* Load log file format */
756771 setLogfileFormat(getStringProperty(properties, TEXT("wrapper.logfile.format"), LOG_FORMAT_LOGFILE_DEFAULT));
757772
758773 /* Load log file log level (stay in silent mode on a translate call) */
759- if (!isPromptCall()) {
774+ if (!wrapperData->silentLog) {
760775 setLogfileLevel(getStringProperty(properties, TEXT("wrapper.logfile.loglevel"), TEXT("INFO")));
761776 }
762777
@@ -785,7 +800,7 @@
785800 setConsoleLogFormat(getStringProperty(properties, TEXT("wrapper.console.format"), LOG_FORMAT_CONSOLE_DEFAULT));
786801
787802 /* Load console log level (stay in silent mode on a translate call) */
788- if (!isPromptCall()) {
803+ if (!wrapperData->silentLog) {
789804 setConsoleLogLevel(getStringProperty(properties, TEXT("wrapper.console.loglevel"), TEXT("INFO")));
790805 }
791806
@@ -824,7 +839,7 @@
824839 }
825840
826841 /* Get the debug status (Property is deprecated but flag is still used) */
827- if (!isPromptCall()) {
842+ if (!wrapperData->silentLog) {
828843 wrapperData->isDebugging = getBooleanProperty(properties, TEXT("wrapper.debug"), FALSE);
829844 if (wrapperData->isDebugging) {
830845 /* For backwards compatability */
@@ -845,7 +860,7 @@
845860 }
846861
847862 /* Load syslog log level (stay in silent mode on a translate call) */
848- if (!isPromptCall()) {
863+ if (!wrapperData->silentLog) {
849864 setSyslogLevel(getStringProperty(properties, TEXT("wrapper.syslog.loglevel"), TEXT("NONE")));
850865 }
851866
@@ -933,6 +948,9 @@
933948 #ifdef HPUX
934949 const TCHAR* fix_iconv_hpux;
935950
951+ /* The properties being loaded here will not be re-loaded, so enable warnings from here. */
952+ setLogPropertyWarnings(properties, TRUE);
953+
936954 fix_iconv_hpux = getStringProperty(properties, TEXT("wrapper.fix_iconv_hpux"), NULL);
937955 if (fix_iconv_hpux && (strcmpIgnoreCase(fix_iconv_hpux, TEXT("ALWAYS")) == 0)) {
938956 /* If Iconv should be fixed, enable it as soon as possible to get the correct conversion when reloading the configuration. */
@@ -951,9 +969,13 @@
951969 wrapperLoadLoggingProperties(TRUE);
952970
953971 wrapperAddDefaultProperties(properties);
972+
973+ /* If the working dir has been changed then we need to restore it before
974+ * the configuration can be reloaded. This is needed to support relative
975+ * references to include files. */
954976 if (wrapperData->workingDir && wrapperData->originalWorkingDir) {
955- if (wrapperSetWorkingDir(wrapperData->originalWorkingDir, FALSE)) {
956- /* Failed to restore the working dir. Shutdown the Wrapper */
977+ if (wrapperSetWorkingDir(wrapperData->originalWorkingDir, TRUE)) {
978+ /* Failed to restore the working dir. The configuration can't be reloaded correctly. Shutdown the Wrapper. */
957979 returnVal = TRUE;
958980 }
959981 }
@@ -1399,6 +1421,9 @@
13991421 firstCall = TRUE;
14001422 /* This is the first time, so preserve the working directory. */
14011423 if (getOriginalWorkingDir()) {
1424+ if (preload) { /* no need to try again as we would fail exactly the same on the second load. */
1425+ preloadFailed = TRUE;
1426+ }
14021427 return TRUE;
14031428 }
14041429 if (wrapperData->configFile) {
@@ -1417,11 +1442,17 @@
14171442 wrapperData->argConfFile, getLastErrorText());
14181443 log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
14191444 TEXT("Current working directory is: %s"), wrapperData->originalWorkingDir);
1445+ if (preload) { /* no need to try again as we would fail exactly the same on the second load. */
1446+ preloadFailed = TRUE;
1447+ }
14201448 return TRUE;
14211449 }
14221450 wrapperData->configFile = malloc(sizeof(TCHAR) * work);
14231451 if (!wrapperData->configFile) {
14241452 outOfMemory(TEXT("WLCP"), 1);
1453+ if (preload) { /* no need to try again as we would fail exactly the same on the second load. */
1454+ preloadFailed = TRUE;
1455+ }
14251456 return TRUE;
14261457 }
14271458 if (!GetFullPathName(wrapperData->argConfFile, work, wrapperData->configFile, NULL)) {
@@ -1430,6 +1461,9 @@
14301461 wrapperData->argConfFile, getLastErrorText());
14311462 log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT(
14321463 "Current working directory is: %s"), wrapperData->originalWorkingDir);
1464+ if (preload) { /* no need to try again as we would fail exactly the same on the second load. */
1465+ preloadFailed = TRUE;
1466+ }
14331467 return TRUE;
14341468 }
14351469 #else
@@ -1439,6 +1473,9 @@
14391473 wrapperData->configFile = malloc(sizeof(TCHAR) * (PATH_MAX + 1));
14401474 if (!wrapperData->configFile) {
14411475 outOfMemory(TEXT("WLCP"), 2);
1476+ if (preload) { /* no need to try again as we would fail exactly the same on the second load. */
1477+ preloadFailed = TRUE;
1478+ }
14421479 return TRUE;
14431480 }
14441481 if (_trealpathN(wrapperData->argConfFile, wrapperData->configFile, PATH_MAX + 1) == NULL) {
@@ -1456,10 +1493,11 @@
14561493 * variable will have the correct full path.
14571494 * Fall through for now and the user will get a better error later. */
14581495 } else {
1459- if (!preload) {
1460- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT(
1461- "Unable to open configuration file: %s (%s)\n Current working directory: %s"),
1462- wrapperData->argConfFile, getLastErrorText(), wrapperData->originalWorkingDir);
1496+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT(
1497+ "Unable to open configuration file: %s (%s)\n Current working directory: %s"),
1498+ wrapperData->argConfFile, getLastErrorText(), wrapperData->originalWorkingDir);
1499+ if (preload) {
1500+ preloadFailed = TRUE;
14631501 }
14641502 return TRUE;
14651503 }
@@ -1473,6 +1511,9 @@
14731511 logLevelOnOverwriteProperties = LEVEL_NONE;
14741512 exitOnOverwriteProperties = FALSE;
14751513 if (!properties) {
1514+ if (preload) { /* OOM reported */
1515+ preloadFailed = TRUE;
1516+ }
14761517 return TRUE;
14771518 }
14781519
@@ -1486,10 +1527,13 @@
14861527 if (!isPromptCall()) {
14871528 for (i = 0; i < wrapperData->argCount; i++) {
14881529 if (addPropertyPair(properties, NULL, 0, wrapperData->argValues[i], TRUE, TRUE, FALSE)) {
1489- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1490- TEXT("The argument '%s' is not a valid property name-value pair."),
1491- wrapperData->argValues[i]);
1492- return TRUE;
1530+ if (!preload) {
1531+ /* Only report this error on the second load, then shutdown. */
1532+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1533+ TEXT("The argument '%s' is not a valid property name-value pair."),
1534+ wrapperData->argValues[i]);
1535+ return TRUE;
1536+ }
14931537 }
14941538 }
14951539 }
@@ -1536,9 +1580,6 @@
15361580 /* Get the error exit code just after the properties have been loaded in case we need to stop before the second load.
15371581 * We will get it again in loadConfiguration() to allow the property to be reloaded. */
15381582 getConfiguredErrorExitCode(TRUE);
1539-
1540- /* If we are in preload mode, we want to enable log warning messages here so everything below this point has propper warnings. */
1541- setLogPropertyWarnings(properties, TRUE);
15421583 } else if (properties->overwrittenPropertyCausedExit) {
15431584 log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Found duplicated properties."));
15441585 return TRUE; /* will cause the wrapper to exit with error code 1 */
@@ -1546,7 +1587,9 @@
15461587
15471588 if (firstCall) {
15481589 /* If the working dir was configured, we need to extract it and preserve its value.
1549- * This must be done after the configuration has been completely loaded. */
1590+ * This must be done after the configuration has been completely loaded.
1591+ * Skip this part when the configuration is reloaded for UNIX daemons (firstCall
1592+ * == FALSE) as there is no reason wrapper.working.dir would have changed. */
15501593 prop = getStringProperty(properties, TEXT("wrapper.working.dir"), TEXT("."));
15511594 if (prop && (_tcslen(prop) > 0)) {
15521595 if (wrapperData->workingDir) {
@@ -1555,18 +1598,29 @@
15551598 #ifdef WIN32
15561599 work = GetFullPathName(prop, 0, NULL, NULL);
15571600 if (!work) {
1558- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1559- TEXT("Unable to resolve the working directory %s: %s"), prop, getLastErrorText());
1601+ if (!preload) {
1602+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1603+ TEXT("Unable to resolve the working directory %s: %s"), prop, getLastErrorText());
1604+ }
1605+ disposeProperties(properties);
1606+ properties = NULL;
15601607 return TRUE;
15611608 }
15621609 wrapperData->workingDir = malloc(sizeof(TCHAR) * work);
15631610 if (!wrapperData->workingDir) {
15641611 outOfMemory(TEXT("WLCP"), 5);
1612+ if (preload) {
1613+ preloadFailed = TRUE;
1614+ }
15651615 return TRUE;
15661616 }
15671617 if (!GetFullPathName(prop, work, wrapperData->workingDir, NULL)) {
1568- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1569- TEXT("Unable to resolve the working directory %s: %s"), prop, getLastErrorText());
1618+ if (!preload) {
1619+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1620+ TEXT("Unable to resolve the working directory %s: %s"), prop, getLastErrorText());
1621+ }
1622+ disposeProperties(properties);
1623+ properties = NULL;
15701624 return TRUE;
15711625 }
15721626 #else
@@ -1576,11 +1630,18 @@
15761630 wrapperData->workingDir = malloc(sizeof(TCHAR) * (PATH_MAX + 1));
15771631 if (!wrapperData->workingDir) {
15781632 outOfMemory(TEXT("WLCP"), 6);
1633+ if (preload) {
1634+ preloadFailed = TRUE;
1635+ }
15791636 return TRUE;
15801637 }
15811638 if (_trealpathN(prop, wrapperData->workingDir, PATH_MAX + 1) == NULL) {
1582- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1583- TEXT("Unable to resolve the working directory %s: %s"), prop, getLastErrorText());
1639+ if (!preload) {
1640+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
1641+ TEXT("Unable to resolve the working directory %s: %s"), prop, getLastErrorText());
1642+ }
1643+ disposeProperties(properties);
1644+ properties = NULL;
15841645 return TRUE;
15851646 }
15861647 #endif
@@ -3534,6 +3595,7 @@
35343595 logRegisterFormatCallbacks(wrapperLogFormatCount, wrapperLogFormatPrint);
35353596
35363597 if (silent) {
3598+ wrapperData->silentLog = TRUE;
35373599 setSilentLogLevels();
35383600 } else {
35393601 setLogfileFormat(TEXT("LPTM"));
@@ -4078,7 +4140,11 @@
40784140 wrapperData->argValues = &argv[4];
40794141 }
40804142 return TRUE;
4081- } else if ((_tcscmp(wrapperData->argCommand, TEXT("-jvm_bits")) == 0) || (_tcscmp(wrapperData->argCommand, TEXT("-request_delta_binary_bits")) == 0)) {
4143+ } else if ((_tcscmp(wrapperData->argCommand, TEXT("-jvm_bits")) == 0) ||
4144+#ifdef WIN32
4145+ (_tcscmp(wrapperData->argCommand, TEXT("-request_log_file")) == 0) ||
4146+#endif
4147+ (_tcscmp(wrapperData->argCommand, TEXT("-request_delta_binary_bits")) == 0)) {
40824148 wrapperData->argConfFile = argv[2];
40834149 wrapperData->argCount = wrapperArgCount - 3;
40844150 wrapperData->argValues = &argv[3];
@@ -5692,7 +5758,7 @@
56925758 consoleHandle = GetStdHandle(STD_INPUT_HANDLE);
56935759 if (consoleHandle == NULL) {
56945760 /* Requested handle does not exist. */
5695- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_INFO, TEXT("Standard input does not exist for process."));
5761+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_INFO, TEXT("Standard input does not exist for the process."));
56965762 } else if (consoleHandle == INVALID_HANDLE_VALUE) {
56975763 log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Faild to retrieve the standard input handle: %s"), getLastErrorText());
56985764 } else {
@@ -6757,7 +6823,7 @@
67576823
67586824 /* Check if the wrapper.java.command is a regular binary */
67596825 if (wrapperData->javaCommandNotBinary) {
6760- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT(" The value of wrapper.java.command does not appear to be a java binary."));
6826+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT(" The value of wrapper.java.command does not appear to be a Java binary."));
67616827 }
67626828
67636829 log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT(" Trying to continue, but some features may not work correctly."));
--- trunk/wrapper/src/c/wrapper.dll.manifest (revision 455)
+++ trunk/wrapper/src/c/wrapper.dll.manifest (revision 456)
@@ -1,7 +1,7 @@
11 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22 <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
33 <!--
4- <assemblyIdentity
4+ <assemblyIdentity
55 type="win32"
66 name="wrapper"
77 version=SXS_ASSEMBLY_VERSION
@@ -18,18 +18,18 @@
1818 </requestedPrivileges>
1919 </security>
2020 </trustInfo>
21- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
22- <application>
23- <!-- Windows 10 -->
21+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
22+ <application>
23+ <!-- Windows 10, Windows Server 2016 and Windows Server 2019 -->
2424 <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
25- <!-- Windows 8.1 -->
25+ <!-- Windows 8.1 and Windows Server 2012 R2 -->
2626 <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
27- <!-- Windows Vista -->
28- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
29- <!-- Windows 7 -->
27+ <!-- Windows 8 and Windows Server 2012 -->
28+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
29+ <!-- Windows 7 and Windows Server 2008 R2 -->
3030 <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
31- <!-- Windows 8 -->
32- <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
33- </application>
31+ <!-- Windows Vista and Windows Server 2008 -->
32+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
33+ </application>
3434 </compatibility>
3535 </assembly>
\ No newline at end of file
--- trunk/wrapper/src/c/wrapper.exe.manifest (revision 455)
+++ trunk/wrapper/src/c/wrapper.exe.manifest (revision 456)
@@ -18,18 +18,18 @@
1818 </requestedPrivileges>
1919 </security>
2020 </trustInfo>
21- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
22- <application>
23- <!-- Windows 10 -->
21+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
22+ <application>
23+ <!-- Windows 10, Windows Server 2016 and Windows Server 2019 -->
2424 <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
25- <!-- Windows 8.1 -->
25+ <!-- Windows 8.1 and Windows Server 2012 R2 -->
2626 <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
27- <!-- Windows Vista -->
28- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
29- <!-- Windows 7 -->
27+ <!-- Windows 8 and Windows Server 2012 -->
28+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
29+ <!-- Windows 7 and Windows Server 2008 R2 -->
3030 <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
31- <!-- Windows 8 -->
32- <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
33- </application>
31+ <!-- Windows Vista and Windows Server 2008 -->
32+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
33+ </application>
3434 </compatibility>
3535 </assembly>
\ No newline at end of file
--- trunk/wrapper/src/c/wrapper.h (revision 455)
+++ trunk/wrapper/src/c/wrapper.h (revision 456)
@@ -257,6 +257,7 @@
257257 TCHAR **argValues; /* Argument values. */
258258 TCHAR **javaArgValues; /* Arguments getting passed over to the java application */
259259 int javaArgValueCount; /* Number of the arguments getting passed over to the java application */
260+ int silentLog; /* TRUE if silent mode was enabled. */
260261
261262 TCHAR *initialPath; /* What the working directory was when the Wrapper process was first launched. */
262263 TCHAR *baseName; /* The name of the wrapper binary without the OS, arch and bits. */
--- trunk/wrapper/src/c/wrapper_unix.c (revision 455)
+++ trunk/wrapper/src/c/wrapper_unix.c (revision 456)
@@ -2009,6 +2009,7 @@
20092009 #if defined(_DEBUG) || defined(UNICODE)
20102010 int i;
20112011 #endif
2012+ int silent = FALSE;
20122013 TCHAR *retLocale;
20132014 int localeSet;
20142015 TCHAR *envLang;
@@ -2076,11 +2077,12 @@
20762077 }
20772078 #endif
20782079
2079- /* Main thread initialized in wrapperInitialize. */
2080- /* We want to disable all log output when a translation request is made.
2081- * Do it right after wrapperInitialize() which sets some log levels.
2082- * Use isPromptCallCommand() instead of isPromptCall() because the arguments are not parsed yet. */
2083- if (wrapperInitialize((argc > 1) && (argv[1][0] == TEXT('-')) && isPromptCallCommand(&argv[1][1]))) {
2080+ if ((argc > 1) && (argv[1][0] == TEXT('-')) && isPromptCallCommand(&argv[1][1])) {
2081+ /* This is a request from the launching script. All log output should be disabled. */
2082+ silent = TRUE;
2083+ }
2084+
2085+ if (wrapperInitialize(silent)) {
20842086 appExit(1, argc, argv);
20852087 return 1; /* For compiler. */
20862088 }
@@ -2182,6 +2184,14 @@
21822184 /* Otherwise return the binary bits */
21832185 appExit(_tcscmp(wrapperBits, TEXT("64")) == 0 ? 64 : 32, argc, argv);
21842186 return 0; /* For compiler. */
2187+ } else if (!strcmpIgnoreCase(wrapperData->argCommand, TEXT("-request_log_file"))) {
2188+ setSimpleLogLevels();
2189+ /* Print out the log file path. */
2190+ _tprintf(TEXT("%s"), getLogfilePath());
2191+ /* Reset silent mode as some queued messages may be printed. */
2192+ setSilentLogLevels();
2193+ appExit(0, argc, argv);
2194+ return 0; /* For compiler. */
21852195 } else if (!strcmpIgnoreCase(wrapperData->argCommand, TEXT("c")) || !strcmpIgnoreCase(wrapperData->argCommand, TEXT("-console"))) {
21862196 /* Run as a console application */
21872197
@@ -2234,13 +2244,6 @@
22342244 }
22352245 }
22362246
2237-
2238- /* See if the logs should be rolled on Wrapper startup. */
2239- if ((getLogfileRollMode() & ROLL_MODE_WRAPPER) ||
2240- (getLogfileRollMode() & ROLL_MODE_JVM)) {
2241- rollLogs(NULL);
2242- }
2243-
22442247 if (checkPidFile()) {
22452248 /* The pid file exists and we are strict, so exit (cleanUpPIDFilesOnExit has not been turned on yet, so we will exit without cleaning the pid files). */
22462249 appExit(wrapperData->errorExitCode, argc, argv);
--- trunk/wrapper/src/c/wrapper_win.c (revision 455)
+++ trunk/wrapper/src/c/wrapper_win.c (revision 456)
@@ -3883,12 +3883,6 @@
38833883 wrapperData->wrapperProcess = GetCurrentProcess();
38843884 wrapperData->wrapperPID = GetCurrentProcessId();
38853885
3886- /* See if the logs should be rolled on Wrapper startup. */
3887- if ((getLogfileRollMode() & ROLL_MODE_WRAPPER) ||
3888- (getLogfileRollMode() & ROLL_MODE_JVM)) {
3889- rollLogs(NULL);
3890- }
3891-
38923886 if (checkPidFile()) {
38933887 /* The pid file exists and we are strict, so exit (cleanUpPIDFilesOnExit has not been turned on yet, so we will exit without cleaning the pid files). */
38943888 appExit(wrapperData->errorExitCode);
@@ -5066,10 +5060,10 @@
50665060 * This can be fixed after installation by changing the security policy of the system. Print a warning and continue. */
50675061 if ((logOnAsServiceOriginalStatus != PRIVILEGE_GRANTED) && !logOnAsServiceAdded) {
50685062 /* Ask the user to add the privilege manually. Is there a way to detect the setting is available? */
5069- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Authentication attempt failed - %s\n Please manually add '%s' to the list of accounts allowed to 'Log on as a service' in your Security Policy Settings.\n Depending on your version of Windows, this setting might not be available."), getErrorText(error, NULL), wrapperData->ntServiceAccount);
5063+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Authentication attempt for '%s' failed - %s\n Please manually add '%s' to the list of accounts allowed to 'Log on as a service' in your Security Policy Settings.\n Depending on your version of Windows, this setting might not be available."), lpszUsername, getErrorText(error, NULL), wrapperData->ntServiceAccount);
50705064 } else {
50715065 /* This may happen if there is a 'Deny log on as a service' security policy for the account. */
5072- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Authentication attempt failed - %s\n Make sure that the account is not prevented from logging on as a service ('Deny log on as a service' policy setting)."), getErrorText(error, NULL));
5066+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Authentication attempt for '%s' failed - %s\n Make sure that the account is not prevented from logging on as a service ('Deny log on as a service' policy setting)."), lpszUsername, getErrorText(error, NULL));
50735067 }
50745068 exit = FALSE;
50755069 break;
@@ -5076,7 +5070,7 @@
50765070
50775071 case 0x52E:
50785072 /* The user name or password is incorrect. */
5079- log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_FATAL : LEVEL_DEBUG, TEXT("Authentication attempt failed - %s"), getErrorText(error, NULL));
5073+ log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_FATAL : LEVEL_DEBUG, TEXT("Authentication attempt for '%s' failed - %s"), lpszUsername, getErrorText(error, NULL));
50805074 if ((wrapperData->ntServicePasswordPrompt) && ((GetKeyState(VK_CAPITAL) & 0x0001) != 0)) {
50815075 log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_WARN : LEVEL_DEBUG, TEXT(" Caps Lock is On!"), getErrorText(error, NULL));
50825076 }
@@ -5086,11 +5080,11 @@
50865080 /* "Account restrictions are preventing this user from signing in...." (see above).
50875081 * Log the error but don't advise to bypass the restriction as this would apply to all services
50885082 * and remote accounts, which is a security concern! */
5089- log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_FATAL : LEVEL_DEBUG, TEXT("Authentication attempt failed - %s"), getErrorText(error, NULL));
5083+ log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_FATAL : LEVEL_DEBUG, TEXT("Authentication attempt for '%s' failed - %s"), lpszUsername, getErrorText(error, NULL));
50905084 break;
50915085
50925086 default:
5093- log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_FATAL : LEVEL_DEBUG, TEXT("Authentication attempt failed - %s"), getErrorText(error, NULL));
5087+ log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_FATAL : LEVEL_DEBUG, TEXT("Authentication attempt for '%s' failed - %s"), lpszUsername, getErrorText(error, NULL));
50945088 }
50955089 }
50965090 if (hToken) {
@@ -7726,6 +7720,7 @@
77267720 void _tmain(int argc, TCHAR **argv) {
77277721 int localeSet = FALSE;
77287722 int defaultLocaleFailed = FALSE;
7723+ int silent = FALSE;
77297724 int result;
77307725 #if defined(_DEBUG)
77317726 int i;
@@ -7778,7 +7773,15 @@
77787773 return; /* For clarity. */
77797774 }
77807775
7781- if (wrapperInitialize((argc > 1) && (argv[1][0] == TEXT('-')) && isPromptCallCommand(&argv[1][1]))) {
7776+ if ((argc > 1) && (argv[1][0] == TEXT('-')) && isPromptCallCommand(&argv[1][1])) {
7777+ /* This is a request from the launching script. All log output should be disabled. */
7778+ silent = TRUE;
7779+ } else if ((argc > 3) && (_tcsstr(argv[3], TEXT("wrapper.internal.namedpipe=")) != NULL)) {
7780+ /* The process was elevated, any configuration issue has already been logged by the parent process. */
7781+ silent = TRUE;
7782+ }
7783+
7784+ if (wrapperInitialize(silent)) {
77827785 appExit(1);
77837786 return; /* For clarity. */
77847787 }
@@ -8171,12 +8174,6 @@
81718174 return; /* For clarity. */
81728175 }
81738176
8174- /* See if the logs should be rolled on Wrapper startup. */
8175- if ((getLogfileRollMode() & ROLL_MODE_WRAPPER) ||
8176- (getLogfileRollMode() & ROLL_MODE_JVM)) {
8177- rollLogs(NULL);
8178- }
8179-
81808177 if (checkPidFile()) {
81818178 /* The pid file exists and we are strict, so exit (cleanUpPIDFilesOnExit has not been turned on yet, so we will exit without cleaning the pid files). */
81828179 appExit(wrapperData->errorExitCode);
@@ -8433,6 +8430,23 @@
84338430 return TRUE;
84348431 }
84358432
8433+void setConfiguredLogLevels() {
8434+ setConsoleLogLevel(getStringProperty(properties, TEXT("wrapper.console.loglevel"), TEXT("INFO")));
8435+ setLogfileLevel(getStringProperty(properties, TEXT("wrapper.logfile.loglevel"), TEXT("INFO")));
8436+ setSyslogLevel(getStringProperty(properties, TEXT("wrapper.syslog.loglevel"), TEXT("NONE")));
8437+ wrapperData->isDebugging = getBooleanProperty(properties, TEXT("wrapper.debug"), FALSE);
8438+ if (wrapperData->isDebugging) {
8439+ /* For backwards compatability */
8440+ setConsoleLogLevelInt(LEVEL_DEBUG);
8441+ setLogfileLevelInt(LEVEL_DEBUG);
8442+ } else {
8443+ if (getLowLogLevel() <= LEVEL_DEBUG) {
8444+ wrapperData->isDebugging = TRUE;
8445+ }
8446+ }
8447+ wrapperData->silentLog = FALSE;
8448+}
8449+
84368450 /* This function needs to get called from the elevated/secondary process.
84378451 * It will open the named pipes, the caller has establishes and redirects stdin, stdout, stderr
84388452 * to this named pipes.
@@ -8448,6 +8462,9 @@
84488462 int ret, fdOut, fdIn, fdErr;
84498463 size_t len;
84508464
8465+ /* Restore the configured log levels so that the elevated process resumes its logging from that point. */
8466+ setConfiguredLogLevels();
8467+
84518468 /* get the base name for the named pipe, each channel will append an additional extension */
84528469 pipeBaseName = getStringProperty(properties, TEXT("wrapper.internal.namedpipe"), NULL);
84538470 if (!pipeBaseName) {
Show on old repository browser