Overview |
|||||
In some situations, a process running on your system might suddenly being terminated and you may not have much clues about the cause. The process itself doesn't have the opportunity to output any error in the terminal or its log file. This can happen if the process crashed, but also if it is being killed by another process running on the system. For example, certain anti-virus softwares sometimes take the initiative to kill a process which is believed to have potential threats. When your program is being killed, you would certainly like to know which process is responsible for that. Usually you would use a debugging tool like gFlags to trace which process sent the kill signal. However, you might not have it installed on your machine, or you might not want to use such tool in production. Starting from version 3.5.42, the Wrapper can be configured to log an output in the Windows Event Log whenever it terminates unexpectedly. It is also possible to configure the same behaviour for its monitored Java process. This feature can be enabled or disabled by just changing the values of the properties below.
For the above properties to take effect, you will need to run the Wrapper with the '--setup'. Adminitrator credentials will be asked if not already granted.
A template batch file called 'SetupApp.bat.in' is also provided in the src/bin folder where the Wrapper is installed. Please refer to the following page for explanation on customizing the template batch files. Once your batch file is ready, you will be able to run the setup by simply executing it.
Once the monitoring is enabled, each exit of the Wrapper will generate an output in the Windows Event Log. If you open the Event Viewer (under 'Control Panel > Administrative Tools'), you will see the following output in the 'Application' section:
As you can see, this output shows which process killed the Wrapper (in our example Taskmgr.exe) and also indicates the termination code of the Wrapper process. To disable exit monitoring, you can set wrapper.monitor_exit (or wrapper.java.monitor_exit) to DISABLED and re-run the Wrapper with the '--setup' command. Alternatively, you may leave the property as is, and run the Wrapper with the '--teardown' command or run the teardown batch file. 注意With this monitoring feature is enabled, an output will be logged to the Event Log whenever the Wrapper or the Java process exits, regardless its exit code. In normal situations you might want disable this feature to avoid cluttering the Event Log. 警告The monitoring feature is enabled per binary name, and not per process. This means that if there are other instances of the Wrapper running on the machine (or other Java processes, when monitoring Java) with the same binary name, the Event Log will also detect and respond to those process terminations. If you want only a specific instance of the Wrapper to be monitored, you may rename wrapper.exe and give it a name which is unique on the machine. If another instance of the Wrapper with the same binary name is started while the monitoring is enabled but wrapper.monitor_exit is not set to ENABLED in its configuration file, the Wrapper will log the following warning:
|
Monitor exit of the Java process |
||||||||||
|