Revision | 456 (tree) |
---|---|
Time | 2020-12-08 17:41:12 |
Author | maxime-tsl |
Work on 3.5.45
@@ -251,6 +251,11 @@ | ||
251 | 251 | <property name="releaseSymbolsFile" value="${releasefile}-SYMBOLS"/> |
252 | 252 | </target> |
253 | 253 | <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> | |
254 | 259 | <!-- Decide on the type of script to generate. --> |
255 | 260 | <property name="is.shell.bat" value="true"/> |
256 | 261 |
@@ -572,7 +577,8 @@ | ||
572 | 577 | </javah> |
573 | 578 | </target> |
574 | 579 | <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. --> | |
576 | 582 | <echo message="White headers to ${build.headers}"/> |
577 | 583 | <javac srcdir="${src.dir}/java" |
578 | 584 | destdir="${build.classes}" |
@@ -748,7 +754,7 @@ | ||
748 | 754 | </target> |
749 | 755 | <target name="compile-c" depends="compile-c-windows-check2,compile-c-unix"> |
750 | 756 | </target> |
751 | - <target name="compile" depends="compile-java, compile-c" | |
757 | + <target name="compile" depends="compile-java, jar, compile-c" | |
752 | 758 | description="Compiles all java and c source"> |
753 | 759 | |
754 | 760 | <mkdir dir="${logs.dir}"/> |
@@ -771,7 +777,9 @@ | ||
771 | 777 | </copy> |
772 | 778 | </target> |
773 | 779 | <target name="jar:build" depends="init-setup" unless="prebuilt.jar.present"> |
780 | + <echo message="> antcall compile-java"/> | |
774 | 781 | <antcall target="compile-java" /> |
782 | + <echo message="< antcall compile-java"/> | |
775 | 783 | |
776 | 784 | <jar jarfile="${lib.dir}/wrapper.jar" |
777 | 785 | basedir="${build.classes}" |
@@ -906,11 +914,6 @@ | ||
906 | 914 | <jar-check-signature filename="wrapperdemo.jar" /> |
907 | 915 | </target> |
908 | 916 | <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> | |
914 | 917 | |
915 | 918 | <!-- =================================================================== --> |
916 | 919 | <!-- Test Task --> |
@@ -1275,6 +1278,7 @@ | ||
1275 | 1278 | <include name="project.dtd" /> |
1276 | 1279 | <include name="lib/wrapper.jar" /> |
1277 | 1280 | <include name="lib/wrappertest.jar" /> |
1281 | + <include name="lib/wrappertest2.jar" /> | |
1278 | 1282 | <include name="lib/wrapperdemo.jar" /> |
1279 | 1283 | <include name="doc/**" /> |
1280 | 1284 | <include name="src/bin/**" /> |
@@ -1414,9 +1418,11 @@ | ||
1414 | 1418 | <mkdir dir="${releasedir}"/> |
1415 | 1419 | <mkdir dir="${releasedir}/bin"/> |
1416 | 1420 | |
1421 | + <echo message="> antcall bin"/> | |
1417 | 1422 | <antcall target="bin" inheritall="false"> |
1418 | 1423 | <param name="bin.dir" value="${releasedir}/bin"/> |
1419 | 1424 | </antcall> |
1425 | + <echo message="< antcall bin"/> | |
1420 | 1426 | |
1421 | 1427 | <mkdir dir="${dist.dir}"/> |
1422 | 1428 | <copy todir="${releasedir}" > |
@@ -1534,9 +1540,11 @@ | ||
1534 | 1540 | <mkdir dir="${releasedir}"/> |
1535 | 1541 | <mkdir dir="${releasedir}/bin"/> |
1536 | 1542 | |
1543 | + <echo message="> antcall bin"/> | |
1537 | 1544 | <antcall target="bin" inheritall="false"> |
1538 | 1545 | <param name="bin.dir" value="${releasedir}/bin"/> |
1539 | 1546 | </antcall> |
1547 | + <echo message="< antcall bin"/> | |
1540 | 1548 | |
1541 | 1549 | <mkdir dir="${dist.dir}"/> |
1542 | 1550 | <copy todir="${releasedir}" > |
@@ -1560,7 +1568,9 @@ | ||
1560 | 1568 | </copy> |
1561 | 1569 | |
1562 | 1570 | <!-- Strip symbols from the binaries. This needs to be done before any signatures are made. --> |
1571 | + <echo message="> antcall release-unix:strip-symbols"/> | |
1563 | 1572 | <antcall target="release-unix:strip-symbols"/> |
1573 | + <echo message="< antcall release-unix:strip-symbols"/> | |
1564 | 1574 | |
1565 | 1575 | <!-- Copy a fresh wrapper.conf rather than the development file --> |
1566 | 1576 | <copy file="${src.dir}/conf/wrapper.conf.in" |
@@ -1618,7 +1628,11 @@ | ||
1618 | 1628 | </copy> |
1619 | 1629 | <fixcrlf srcdir="${releasedir}" encoding="UTF-8" outputencoding="UTF-8" includes="README_*.txt" eol="lf"/> |
1620 | 1630 | |
1621 | - <!--<antcall target="release-unix:check-consistency"/> --> | |
1631 | + <!-- | |
1632 | + <echo message="> antcall release-unix:check-consistency"/> | |
1633 | + <antcall target="release-unix:check-consistency"/> | |
1634 | + <echo message="< antcall release-unix:check-consistency"/> | |
1635 | + --> | |
1622 | 1636 | |
1623 | 1637 | <tar tarfile="${build.dir}/${releasefile}.tar"> |
1624 | 1638 | <tarfileset dir="${build.dir}" mode="755"> |
@@ -1826,6 +1840,7 @@ | ||
1826 | 1840 | <attribute name="wrapperlibtail"/> |
1827 | 1841 | <attribute name="archivetype"/> |
1828 | 1842 | <sequential> |
1843 | + <echo message="> antcall release-delta:extract-platform"/> | |
1829 | 1844 | <antcall target="release-delta:extract-platform"> |
1830 | 1845 | <param name="d-osname" value="@{osname}"/> |
1831 | 1846 | <param name="d-osarch" value="@{osarch}"/> |
@@ -1836,6 +1851,7 @@ | ||
1836 | 1851 | <param name="d-wrapperlibtail" value="@{wrapperlibtail}"/> |
1837 | 1852 | <param name="d-archivetype" value="@{archivetype}"/> |
1838 | 1853 | </antcall> |
1854 | + <echo message="< antcall release-delta:extract-platform"/> | |
1839 | 1855 | </sequential> |
1840 | 1856 | </macrodef> |
1841 | 1857 | <target name="release-delta:extract-platforms"> |
@@ -1873,14 +1889,19 @@ | ||
1873 | 1889 | <mkdir dir="${releasedir}"/> |
1874 | 1890 | <mkdir dir="${releasedir}/bin"/> |
1875 | 1891 | |
1892 | + <echo message="> antcall bin"/> | |
1876 | 1893 | <antcall target="bin" inheritall="false"> |
1877 | 1894 | <param name="bin.dir" value="${releasedir}/bin"/> |
1878 | 1895 | <param name="is.shell.bat" value="true"/> |
1879 | 1896 | </antcall> |
1897 | + <echo message="< antcall bin"/> | |
1898 | + | |
1899 | + <echo message="> antcall bin"/> | |
1880 | 1900 | <antcall target="bin" inheritall="false"> |
1881 | 1901 | <param name="bin.dir" value="${releasedir}/bin"/> |
1882 | 1902 | <param name="is.shell.sh" value="true"/> |
1883 | 1903 | </antcall> |
1904 | + <echo message="< antcall bin"/> | |
1884 | 1905 | |
1885 | 1906 | <copy todir="${releasedir}"> |
1886 | 1907 | <fileset dir="${basedir}"> |
@@ -2031,7 +2052,7 @@ | ||
2031 | 2052 | <!-- Release --> |
2032 | 2053 | <!-- =================================================================== --> |
2033 | 2054 | <target name="release" |
2034 | - depends="test-setup, bin, conf, release-windows, release-unix" | |
2055 | + depends="bin, conf, test-setup, release-windows, release-unix" | |
2035 | 2056 | description="Builds all release files for the current platform"> |
2036 | 2057 | </target> |
2037 | 2058 |
@@ -2089,6 +2110,7 @@ | ||
2089 | 2110 | |
2090 | 2111 | <delete file="${lib.dir}/wrapper.jar"/> |
2091 | 2112 | <delete file="${lib.dir}/wrappertest.jar"/> |
2113 | + <delete file="${lib.dir}/wrappertest2.jar"/> | |
2092 | 2114 | <delete file="${lib.dir}/wrapperdemo.jar"/> |
2093 | 2115 | |
2094 | 2116 | <!-- Windows --> |
@@ -3,20 +3,20 @@ | ||
3 | 3 | 3.5.45 |
4 | 4 | * Fix a problem where Windows binaries were not being signed correctly in the |
5 | 5 | 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. | |
10 | 10 | * Fix a problem where the Wrapper would fail to start if the shell script was |
11 | 11 | 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 | |
14 | 14 | built-in engine is found, an external engine can be specified by setting the |
15 | 15 | 'external.js.engine.dir' property when calling Ant. (Bug #313) |
16 | 16 | * Add a new _WRAPPER_TIMEOUT setting in the Windows batch scripts which makes |
17 | 17 | it possible to control the maximum number of seconds to pause on exit when |
18 | 18 | 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 | |
20 | 20 | automatically using 'javac -h' instead of 'javah'. (Bug #312) |
21 | 21 | * Use the value of javac.target.version in default.properties (Ant file) as the |
22 | 22 | minimum version of Java supported by the Wrapper instead of a hard-coded |
@@ -27,9 +27,27 @@ | ||
27 | 27 | * Fix a problem where the Wrapper would show an error on startup if the stdin |
28 | 28 | pipe was not tied to a console window. This can happen when called within |
29 | 29 | 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 | |
32 | 32 | 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. | |
33 | 51 | * The z/Linux distributions are now built on a IBM z14 machine with RedHat |
34 | 52 | Linux 7.8. |
35 | 53 |
@@ -1201,6 +1201,9 @@ | ||
1201 | 1201 | TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT` |
1202 | 1202 | pidtest=`$PS_BIN -p $pid -o args | grep -F "$TRUNCATED_CMD" | tail -1` |
1203 | 1203 | ;; |
1204 | + 'linux') | |
1205 | + pidtest=`$PS_BIN -ww -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1` | |
1206 | + ;; | |
1204 | 1207 | *) |
1205 | 1208 | pidtest=`$PS_BIN -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1` |
1206 | 1209 | ;; |
@@ -1383,7 +1386,20 @@ | ||
1383 | 1386 | done |
1384 | 1387 | echo "" |
1385 | 1388 | } |
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 | + | |
1387 | 1403 | startwait() { |
1388 | 1404 | if [ $WAIT_FOR_STARTED_STATUS = true ] |
1389 | 1405 | then |
@@ -1404,7 +1420,8 @@ | ||
1404 | 1420 | getpid |
1405 | 1421 | if [ "X$pid" = "X" ] |
1406 | 1422 | 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 " " | |
1408 | 1425 | exit 1 |
1409 | 1426 | else |
1410 | 1427 | eval echo `gettext ' running: PID:$pid'` |
@@ -1688,6 +1705,7 @@ | ||
1688 | 1705 | systemctl start $APP_NAME |
1689 | 1706 | if [ $? -ne 0 ] ; then |
1690 | 1707 | eval echo `gettext 'Failed to start $APP_LONG_NAME.'` |
1708 | + printlogfilepath | |
1691 | 1709 | exit 1 |
1692 | 1710 | fi |
1693 | 1711 |
@@ -1717,6 +1735,7 @@ | ||
1717 | 1735 | systemctl restart $APP_NAME |
1718 | 1736 | if [ $? -ne 0 ] ; then |
1719 | 1737 | eval echo `gettext 'Failed to restart service $APP_NAME'` |
1738 | + printlogfilepath | |
1720 | 1739 | exit 1 |
1721 | 1740 | fi |
1722 | 1741 |
@@ -1772,6 +1791,7 @@ | ||
1772 | 1791 | startsrc -s "${APP_NAME}" |
1773 | 1792 | if [ $? -ne 0 ] ; then |
1774 | 1793 | eval echo `gettext 'Failed to start $APP_LONG_NAME.'` |
1794 | + printlogfilepath | |
1775 | 1795 | exit 1 |
1776 | 1796 | fi |
1777 | 1797 |
@@ -3708,7 +3708,6 @@ | ||
3708 | 3708 | uptimeFlipped = flipped; |
3709 | 3709 | } |
3710 | 3710 | |
3711 | -int rollFailure = FALSE; | |
3712 | 3711 | /** |
3713 | 3712 | * Rolls log files using the ROLLNUM system. |
3714 | 3713 | * |
@@ -3716,6 +3715,7 @@ | ||
3716 | 3715 | * If NULL, the current date will be used. |
3717 | 3716 | */ |
3718 | 3717 | void rollLogs(const TCHAR *nowStr) { |
3718 | + static int failureLogged = FALSE; | |
3719 | 3719 | int i; |
3720 | 3720 | TCHAR rollNum[11]; |
3721 | 3721 | #if defined(WIN32) && !defined(WIN64) |
@@ -3765,10 +3765,17 @@ | ||
3765 | 3765 | fclose(logfileFP); |
3766 | 3766 | logfileFP = NULL; |
3767 | 3767 | 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 | + } | |
3768 | 3775 | } |
3769 | 3776 | |
3770 | 3777 | #ifdef _DEBUG |
3771 | - _tprintf(TEXT("Rolling log files... (rollFailure=%d)\n"), rollFailure); | |
3778 | + _tprintf(TEXT("Rolling log files... (failureLogged=%d)\n"), failureLogged); | |
3772 | 3779 | #endif |
3773 | 3780 | |
3774 | 3781 | /* We don't know how many log files need to be rotated yet, so look. */ |
@@ -3807,10 +3814,10 @@ | ||
3807 | 3814 | } else if (getLastError() == 3) { |
3808 | 3815 | /* The path did not exist. */ |
3809 | 3816 | } else { |
3810 | - if (rollFailure == FALSE) { | |
3817 | + if (!failureLogged) { | |
3811 | 3818 | log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to delete old log file: %s (%s)"), workLogFileName, getLastErrorText()); |
3819 | + failureLogged = TRUE; | |
3812 | 3820 | } |
3813 | - rollFailure = TRUE; | |
3814 | 3821 | generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */ |
3815 | 3822 | return; |
3816 | 3823 | } |
@@ -3821,10 +3828,10 @@ | ||
3821 | 3828 | #ifdef _DEBUG |
3822 | 3829 | _tprintf(TEXT("Failed to remove old log file %s\n"), workLogFileName); |
3823 | 3830 | #endif |
3824 | - if (rollFailure == FALSE) { | |
3831 | + if (!failureLogged) { | |
3825 | 3832 | log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to delete old log file: %s"), workLogFileName); |
3833 | + failureLogged = TRUE; | |
3826 | 3834 | } |
3827 | - rollFailure = TRUE; | |
3828 | 3835 | generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */ |
3829 | 3836 | return; |
3830 | 3837 | } |
@@ -3836,7 +3843,7 @@ | ||
3836 | 3843 | } |
3837 | 3844 | } else { |
3838 | 3845 | if (_trename(workLogFileName, currentLogFileName) != 0) { |
3839 | - if (rollFailure == FALSE) { | |
3846 | + if (!failureLogged) { | |
3840 | 3847 | #ifdef WIN32 |
3841 | 3848 | if (errno == EACCES) { |
3842 | 3849 | /* 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 @@ | ||
3851 | 3858 | #ifdef WIN32 |
3852 | 3859 | } |
3853 | 3860 | #endif |
3861 | + failureLogged = TRUE; | |
3854 | 3862 | } |
3855 | - rollFailure = TRUE; | |
3856 | 3863 | generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */ |
3857 | 3864 | return; |
3858 | 3865 | } |
@@ -3867,7 +3874,7 @@ | ||
3867 | 3874 | /* Rename the current file to the #1 index position */ |
3868 | 3875 | generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); |
3869 | 3876 | if (_trename(currentLogFileName, workLogFileName) != 0) { |
3870 | - if (rollFailure == FALSE) { | |
3877 | + if (!failureLogged) { | |
3871 | 3878 | if (getLastError() == 2) { |
3872 | 3879 | /* File does not yet exist. */ |
3873 | 3880 | } else if (getLastError() == 3) { |
@@ -3882,8 +3889,8 @@ | ||
3882 | 3889 | log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to rename log file %s to %s. (%s)"), |
3883 | 3890 | currentLogFileName, workLogFileName, getLastErrorText()); |
3884 | 3891 | } |
3892 | + failureLogged = TRUE; | |
3885 | 3893 | } |
3886 | - rollFailure = TRUE; | |
3887 | 3894 | generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */ |
3888 | 3895 | return; |
3889 | 3896 | } |
@@ -3899,12 +3906,12 @@ | ||
3899 | 3906 | limitLogFileCount(currentLogFileName, logFilePurgePattern, logFilePurgeSortMode, logFileMaxLogFiles + 1); |
3900 | 3907 | } |
3901 | 3908 | } |
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. */ | |
3904 | 3911 | log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, |
3905 | 3912 | TEXT("Logfile rolling is working again.")); |
3913 | + failureLogged = FALSE; | |
3906 | 3914 | } |
3907 | - rollFailure = FALSE; | |
3908 | 3915 | |
3909 | 3916 | /* Reset the current log file name as it is not being used yet. */ |
3910 | 3917 | currentLogFileName[0] = TEXT('\0'); /* Log file was rolled, so we want to cause a logfile change event. */ |
@@ -676,6 +676,7 @@ | ||
676 | 676 | properties->ignoreVarMap = newHashMap(8); |
677 | 677 | properties->dumpFormat = NULL; |
678 | 678 | if ((!properties->warnedVarMap) || (!properties->ignoreVarMap)) { |
679 | + outOfMemory(TEXT("CP"), 2); | |
679 | 680 | disposeProperties(properties); |
680 | 681 | return NULL; |
681 | 682 | } |
@@ -86,7 +86,7 @@ | ||
86 | 86 | struct Properties { |
87 | 87 | int debugProperties; /* TRUE if debug information on Properties should be shown. */ |
88 | 88 | 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). */ | |
90 | 90 | int overwrittenPropertyCausedExit; /* Flag to keep trace whether at least one property was overridden */ |
91 | 91 | int logWarnings; /* Flag that controls whether or not warnings will be logged. */ |
92 | 92 | int logWarningLogLevel; /* Log level at which any log warnings will be logged. */ |
@@ -676,7 +676,7 @@ | ||
676 | 676 | #endif |
677 | 677 | |
678 | 678 | /** |
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). | |
680 | 680 | * |
681 | 681 | * @param argCommand the first arguement passed when launching the Wrapper |
682 | 682 | */ |
@@ -686,11 +686,14 @@ | ||
686 | 686 | } |
687 | 687 | return ((strcmpIgnoreCase(argCommand, TEXT("-translate")) == 0) || |
688 | 688 | (strcmpIgnoreCase(argCommand, TEXT("-jvm_bits")) == 0) || |
689 | +#ifndef WIN32 | |
690 | + (strcmpIgnoreCase(argCommand, TEXT("-request_log_file")) == 0) || | |
691 | +#endif | |
689 | 692 | (strcmpIgnoreCase(argCommand, TEXT("-request_delta_binary_bits")) == 0)); |
690 | 693 | } |
691 | 694 | |
692 | 695 | /** |
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). | |
694 | 697 | * This function must be called after the arguments have been parsed! |
695 | 698 | */ |
696 | 699 | int isPromptCall() { |
@@ -752,11 +755,23 @@ | ||
752 | 755 | } |
753 | 756 | setLogfileRollMode(logfileRollMode); |
754 | 757 | |
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 | + | |
755 | 770 | /* Load log file format */ |
756 | 771 | setLogfileFormat(getStringProperty(properties, TEXT("wrapper.logfile.format"), LOG_FORMAT_LOGFILE_DEFAULT)); |
757 | 772 | |
758 | 773 | /* Load log file log level (stay in silent mode on a translate call) */ |
759 | - if (!isPromptCall()) { | |
774 | + if (!wrapperData->silentLog) { | |
760 | 775 | setLogfileLevel(getStringProperty(properties, TEXT("wrapper.logfile.loglevel"), TEXT("INFO"))); |
761 | 776 | } |
762 | 777 |
@@ -785,7 +800,7 @@ | ||
785 | 800 | setConsoleLogFormat(getStringProperty(properties, TEXT("wrapper.console.format"), LOG_FORMAT_CONSOLE_DEFAULT)); |
786 | 801 | |
787 | 802 | /* Load console log level (stay in silent mode on a translate call) */ |
788 | - if (!isPromptCall()) { | |
803 | + if (!wrapperData->silentLog) { | |
789 | 804 | setConsoleLogLevel(getStringProperty(properties, TEXT("wrapper.console.loglevel"), TEXT("INFO"))); |
790 | 805 | } |
791 | 806 |
@@ -824,7 +839,7 @@ | ||
824 | 839 | } |
825 | 840 | |
826 | 841 | /* Get the debug status (Property is deprecated but flag is still used) */ |
827 | - if (!isPromptCall()) { | |
842 | + if (!wrapperData->silentLog) { | |
828 | 843 | wrapperData->isDebugging = getBooleanProperty(properties, TEXT("wrapper.debug"), FALSE); |
829 | 844 | if (wrapperData->isDebugging) { |
830 | 845 | /* For backwards compatability */ |
@@ -845,7 +860,7 @@ | ||
845 | 860 | } |
846 | 861 | |
847 | 862 | /* Load syslog log level (stay in silent mode on a translate call) */ |
848 | - if (!isPromptCall()) { | |
863 | + if (!wrapperData->silentLog) { | |
849 | 864 | setSyslogLevel(getStringProperty(properties, TEXT("wrapper.syslog.loglevel"), TEXT("NONE"))); |
850 | 865 | } |
851 | 866 |
@@ -933,6 +948,9 @@ | ||
933 | 948 | #ifdef HPUX |
934 | 949 | const TCHAR* fix_iconv_hpux; |
935 | 950 | |
951 | + /* The properties being loaded here will not be re-loaded, so enable warnings from here. */ | |
952 | + setLogPropertyWarnings(properties, TRUE); | |
953 | + | |
936 | 954 | fix_iconv_hpux = getStringProperty(properties, TEXT("wrapper.fix_iconv_hpux"), NULL); |
937 | 955 | if (fix_iconv_hpux && (strcmpIgnoreCase(fix_iconv_hpux, TEXT("ALWAYS")) == 0)) { |
938 | 956 | /* If Iconv should be fixed, enable it as soon as possible to get the correct conversion when reloading the configuration. */ |
@@ -951,9 +969,13 @@ | ||
951 | 969 | wrapperLoadLoggingProperties(TRUE); |
952 | 970 | |
953 | 971 | 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. */ | |
954 | 976 | 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. */ | |
957 | 979 | returnVal = TRUE; |
958 | 980 | } |
959 | 981 | } |
@@ -1399,6 +1421,9 @@ | ||
1399 | 1421 | firstCall = TRUE; |
1400 | 1422 | /* This is the first time, so preserve the working directory. */ |
1401 | 1423 | 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 | + } | |
1402 | 1427 | return TRUE; |
1403 | 1428 | } |
1404 | 1429 | if (wrapperData->configFile) { |
@@ -1417,11 +1442,17 @@ | ||
1417 | 1442 | wrapperData->argConfFile, getLastErrorText()); |
1418 | 1443 | log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, |
1419 | 1444 | 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 | + } | |
1420 | 1448 | return TRUE; |
1421 | 1449 | } |
1422 | 1450 | wrapperData->configFile = malloc(sizeof(TCHAR) * work); |
1423 | 1451 | if (!wrapperData->configFile) { |
1424 | 1452 | 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 | + } | |
1425 | 1456 | return TRUE; |
1426 | 1457 | } |
1427 | 1458 | if (!GetFullPathName(wrapperData->argConfFile, work, wrapperData->configFile, NULL)) { |
@@ -1430,6 +1461,9 @@ | ||
1430 | 1461 | wrapperData->argConfFile, getLastErrorText()); |
1431 | 1462 | log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT( |
1432 | 1463 | "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 | + } | |
1433 | 1467 | return TRUE; |
1434 | 1468 | } |
1435 | 1469 | #else |
@@ -1439,6 +1473,9 @@ | ||
1439 | 1473 | wrapperData->configFile = malloc(sizeof(TCHAR) * (PATH_MAX + 1)); |
1440 | 1474 | if (!wrapperData->configFile) { |
1441 | 1475 | 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 | + } | |
1442 | 1479 | return TRUE; |
1443 | 1480 | } |
1444 | 1481 | if (_trealpathN(wrapperData->argConfFile, wrapperData->configFile, PATH_MAX + 1) == NULL) { |
@@ -1456,10 +1493,11 @@ | ||
1456 | 1493 | * variable will have the correct full path. |
1457 | 1494 | * Fall through for now and the user will get a better error later. */ |
1458 | 1495 | } 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; | |
1463 | 1501 | } |
1464 | 1502 | return TRUE; |
1465 | 1503 | } |
@@ -1473,6 +1511,9 @@ | ||
1473 | 1511 | logLevelOnOverwriteProperties = LEVEL_NONE; |
1474 | 1512 | exitOnOverwriteProperties = FALSE; |
1475 | 1513 | if (!properties) { |
1514 | + if (preload) { /* OOM reported */ | |
1515 | + preloadFailed = TRUE; | |
1516 | + } | |
1476 | 1517 | return TRUE; |
1477 | 1518 | } |
1478 | 1519 |
@@ -1486,10 +1527,13 @@ | ||
1486 | 1527 | if (!isPromptCall()) { |
1487 | 1528 | for (i = 0; i < wrapperData->argCount; i++) { |
1488 | 1529 | 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 | + } | |
1493 | 1537 | } |
1494 | 1538 | } |
1495 | 1539 | } |
@@ -1536,9 +1580,6 @@ | ||
1536 | 1580 | /* Get the error exit code just after the properties have been loaded in case we need to stop before the second load. |
1537 | 1581 | * We will get it again in loadConfiguration() to allow the property to be reloaded. */ |
1538 | 1582 | 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); | |
1542 | 1583 | } else if (properties->overwrittenPropertyCausedExit) { |
1543 | 1584 | log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Found duplicated properties.")); |
1544 | 1585 | return TRUE; /* will cause the wrapper to exit with error code 1 */ |
@@ -1546,7 +1587,9 @@ | ||
1546 | 1587 | |
1547 | 1588 | if (firstCall) { |
1548 | 1589 | /* 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. */ | |
1550 | 1593 | prop = getStringProperty(properties, TEXT("wrapper.working.dir"), TEXT(".")); |
1551 | 1594 | if (prop && (_tcslen(prop) > 0)) { |
1552 | 1595 | if (wrapperData->workingDir) { |
@@ -1555,18 +1598,29 @@ | ||
1555 | 1598 | #ifdef WIN32 |
1556 | 1599 | work = GetFullPathName(prop, 0, NULL, NULL); |
1557 | 1600 | 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; | |
1560 | 1607 | return TRUE; |
1561 | 1608 | } |
1562 | 1609 | wrapperData->workingDir = malloc(sizeof(TCHAR) * work); |
1563 | 1610 | if (!wrapperData->workingDir) { |
1564 | 1611 | outOfMemory(TEXT("WLCP"), 5); |
1612 | + if (preload) { | |
1613 | + preloadFailed = TRUE; | |
1614 | + } | |
1565 | 1615 | return TRUE; |
1566 | 1616 | } |
1567 | 1617 | 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; | |
1570 | 1624 | return TRUE; |
1571 | 1625 | } |
1572 | 1626 | #else |
@@ -1576,11 +1630,18 @@ | ||
1576 | 1630 | wrapperData->workingDir = malloc(sizeof(TCHAR) * (PATH_MAX + 1)); |
1577 | 1631 | if (!wrapperData->workingDir) { |
1578 | 1632 | outOfMemory(TEXT("WLCP"), 6); |
1633 | + if (preload) { | |
1634 | + preloadFailed = TRUE; | |
1635 | + } | |
1579 | 1636 | return TRUE; |
1580 | 1637 | } |
1581 | 1638 | 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; | |
1584 | 1645 | return TRUE; |
1585 | 1646 | } |
1586 | 1647 | #endif |
@@ -3534,6 +3595,7 @@ | ||
3534 | 3595 | logRegisterFormatCallbacks(wrapperLogFormatCount, wrapperLogFormatPrint); |
3535 | 3596 | |
3536 | 3597 | if (silent) { |
3598 | + wrapperData->silentLog = TRUE; | |
3537 | 3599 | setSilentLogLevels(); |
3538 | 3600 | } else { |
3539 | 3601 | setLogfileFormat(TEXT("LPTM")); |
@@ -4078,7 +4140,11 @@ | ||
4078 | 4140 | wrapperData->argValues = &argv[4]; |
4079 | 4141 | } |
4080 | 4142 | 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)) { | |
4082 | 4148 | wrapperData->argConfFile = argv[2]; |
4083 | 4149 | wrapperData->argCount = wrapperArgCount - 3; |
4084 | 4150 | wrapperData->argValues = &argv[3]; |
@@ -5692,7 +5758,7 @@ | ||
5692 | 5758 | consoleHandle = GetStdHandle(STD_INPUT_HANDLE); |
5693 | 5759 | if (consoleHandle == NULL) { |
5694 | 5760 | /* 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.")); | |
5696 | 5762 | } else if (consoleHandle == INVALID_HANDLE_VALUE) { |
5697 | 5763 | log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Faild to retrieve the standard input handle: %s"), getLastErrorText()); |
5698 | 5764 | } else { |
@@ -6757,7 +6823,7 @@ | ||
6757 | 6823 | |
6758 | 6824 | /* Check if the wrapper.java.command is a regular binary */ |
6759 | 6825 | 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.")); | |
6761 | 6827 | } |
6762 | 6828 | |
6763 | 6829 | log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT(" Trying to continue, but some features may not work correctly.")); |
@@ -1,7 +1,7 @@ | ||
1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
2 | 2 | <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> |
3 | 3 | <!-- |
4 | - <assemblyIdentity | |
4 | + <assemblyIdentity | |
5 | 5 | type="win32" |
6 | 6 | name="wrapper" |
7 | 7 | version=SXS_ASSEMBLY_VERSION |
@@ -18,18 +18,18 @@ | ||
18 | 18 | </requestedPrivileges> |
19 | 19 | </security> |
20 | 20 | </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 --> | |
24 | 24 | <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> |
25 | - <!-- Windows 8.1 --> | |
25 | + <!-- Windows 8.1 and Windows Server 2012 R2 --> | |
26 | 26 | <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 --> | |
30 | 30 | <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> | |
34 | 34 | </compatibility> |
35 | 35 | </assembly> |
\ No newline at end of file |
@@ -18,18 +18,18 @@ | ||
18 | 18 | </requestedPrivileges> |
19 | 19 | </security> |
20 | 20 | </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 --> | |
24 | 24 | <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> |
25 | - <!-- Windows 8.1 --> | |
25 | + <!-- Windows 8.1 and Windows Server 2012 R2 --> | |
26 | 26 | <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 --> | |
30 | 30 | <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> | |
34 | 34 | </compatibility> |
35 | 35 | </assembly> |
\ No newline at end of file |
@@ -257,6 +257,7 @@ | ||
257 | 257 | TCHAR **argValues; /* Argument values. */ |
258 | 258 | TCHAR **javaArgValues; /* Arguments getting passed over to the java application */ |
259 | 259 | int javaArgValueCount; /* Number of the arguments getting passed over to the java application */ |
260 | + int silentLog; /* TRUE if silent mode was enabled. */ | |
260 | 261 | |
261 | 262 | TCHAR *initialPath; /* What the working directory was when the Wrapper process was first launched. */ |
262 | 263 | TCHAR *baseName; /* The name of the wrapper binary without the OS, arch and bits. */ |
@@ -2009,6 +2009,7 @@ | ||
2009 | 2009 | #if defined(_DEBUG) || defined(UNICODE) |
2010 | 2010 | int i; |
2011 | 2011 | #endif |
2012 | + int silent = FALSE; | |
2012 | 2013 | TCHAR *retLocale; |
2013 | 2014 | int localeSet; |
2014 | 2015 | TCHAR *envLang; |
@@ -2076,11 +2077,12 @@ | ||
2076 | 2077 | } |
2077 | 2078 | #endif |
2078 | 2079 | |
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)) { | |
2084 | 2086 | appExit(1, argc, argv); |
2085 | 2087 | return 1; /* For compiler. */ |
2086 | 2088 | } |
@@ -2182,6 +2184,14 @@ | ||
2182 | 2184 | /* Otherwise return the binary bits */ |
2183 | 2185 | appExit(_tcscmp(wrapperBits, TEXT("64")) == 0 ? 64 : 32, argc, argv); |
2184 | 2186 | 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. */ | |
2185 | 2195 | } else if (!strcmpIgnoreCase(wrapperData->argCommand, TEXT("c")) || !strcmpIgnoreCase(wrapperData->argCommand, TEXT("-console"))) { |
2186 | 2196 | /* Run as a console application */ |
2187 | 2197 |
@@ -2234,13 +2244,6 @@ | ||
2234 | 2244 | } |
2235 | 2245 | } |
2236 | 2246 | |
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 | - | |
2244 | 2247 | if (checkPidFile()) { |
2245 | 2248 | /* 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). */ |
2246 | 2249 | appExit(wrapperData->errorExitCode, argc, argv); |
@@ -3883,12 +3883,6 @@ | ||
3883 | 3883 | wrapperData->wrapperProcess = GetCurrentProcess(); |
3884 | 3884 | wrapperData->wrapperPID = GetCurrentProcessId(); |
3885 | 3885 | |
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 | - | |
3892 | 3886 | if (checkPidFile()) { |
3893 | 3887 | /* 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). */ |
3894 | 3888 | appExit(wrapperData->errorExitCode); |
@@ -5066,10 +5060,10 @@ | ||
5066 | 5060 | * This can be fixed after installation by changing the security policy of the system. Print a warning and continue. */ |
5067 | 5061 | if ((logOnAsServiceOriginalStatus != PRIVILEGE_GRANTED) && !logOnAsServiceAdded) { |
5068 | 5062 | /* 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); | |
5070 | 5064 | } else { |
5071 | 5065 | /* 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)); | |
5073 | 5067 | } |
5074 | 5068 | exit = FALSE; |
5075 | 5069 | break; |
@@ -5076,7 +5070,7 @@ | ||
5076 | 5070 | |
5077 | 5071 | case 0x52E: |
5078 | 5072 | /* 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)); | |
5080 | 5074 | if ((wrapperData->ntServicePasswordPrompt) && ((GetKeyState(VK_CAPITAL) & 0x0001) != 0)) { |
5081 | 5075 | log_printf(WRAPPER_SOURCE_WRAPPER, exit ? LEVEL_WARN : LEVEL_DEBUG, TEXT(" Caps Lock is On!"), getErrorText(error, NULL)); |
5082 | 5076 | } |
@@ -5086,11 +5080,11 @@ | ||
5086 | 5080 | /* "Account restrictions are preventing this user from signing in...." (see above). |
5087 | 5081 | * Log the error but don't advise to bypass the restriction as this would apply to all services |
5088 | 5082 | * 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)); | |
5090 | 5084 | break; |
5091 | 5085 | |
5092 | 5086 | 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)); | |
5094 | 5088 | } |
5095 | 5089 | } |
5096 | 5090 | if (hToken) { |
@@ -7726,6 +7720,7 @@ | ||
7726 | 7720 | void _tmain(int argc, TCHAR **argv) { |
7727 | 7721 | int localeSet = FALSE; |
7728 | 7722 | int defaultLocaleFailed = FALSE; |
7723 | + int silent = FALSE; | |
7729 | 7724 | int result; |
7730 | 7725 | #if defined(_DEBUG) |
7731 | 7726 | int i; |
@@ -7778,7 +7773,15 @@ | ||
7778 | 7773 | return; /* For clarity. */ |
7779 | 7774 | } |
7780 | 7775 | |
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)) { | |
7782 | 7785 | appExit(1); |
7783 | 7786 | return; /* For clarity. */ |
7784 | 7787 | } |
@@ -8171,12 +8174,6 @@ | ||
8171 | 8174 | return; /* For clarity. */ |
8172 | 8175 | } |
8173 | 8176 | |
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 | - | |
8180 | 8177 | if (checkPidFile()) { |
8181 | 8178 | /* 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). */ |
8182 | 8179 | appExit(wrapperData->errorExitCode); |
@@ -8433,6 +8430,23 @@ | ||
8433 | 8430 | return TRUE; |
8434 | 8431 | } |
8435 | 8432 | |
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 | + | |
8436 | 8450 | /* This function needs to get called from the elevated/secondary process. |
8437 | 8451 | * It will open the named pipes, the caller has establishes and redirects stdin, stdout, stderr |
8438 | 8452 | * to this named pipes. |
@@ -8448,6 +8462,9 @@ | ||
8448 | 8462 | int ret, fdOut, fdIn, fdErr; |
8449 | 8463 | size_t len; |
8450 | 8464 | |
8465 | + /* Restore the configured log levels so that the elevated process resumes its logging from that point. */ | |
8466 | + setConfiguredLogLevels(); | |
8467 | + | |
8451 | 8468 | /* get the base name for the named pipe, each channel will append an additional extension */ |
8452 | 8469 | pipeBaseName = getStringProperty(properties, TEXT("wrapper.internal.namedpipe"), NULL); |
8453 | 8470 | if (!pipeBaseName) { |