Repository navigation
Integration with services
Fabrice Bacchella edited this page Nov 20, 2025
·
1 revision
LogHub can run as a native service on both Linux and Windows. The application detects the operating system and uses systemd on Linux or Apache Procrun on Windows by implementing the appropriate service interfaces.
LogHub will detect that it run under systemd and expose status information via sd_notify.
[Unit]
Description=LogHub Service
After=network-online.target
[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/loghub
ExecStart=.../bin/java ... -jar .../loghub.jar -c .../loghub.conf
User=loghub
TimeoutSec=30
Restart=on-failure
RestartPreventExitStatus=10 11 12
[Install]
WantedBy=multi-user.targetApache Procrun allows a Java application to be installed and run as a Windows Service. LogHub provides:
- A startup class with a
windowsStartmethod. - A shutdown class with a
windowsStopmethod.
These methods are invoked by Procrun depending on the service lifecycle.
Below is an example using prunsrv.exe to install the service:
prunsrv //IS//MyApp ^
--DisplayName="LogHub" ^
--Description="LogHub" ^
--Install="C:\\procrun\\prunsrv.exe" ^
--Jvm=auto ^
--StartMode=jvm ^
--StopMode=jvm ^
--Classpath="...\\loghub.jar" ^
--StartClass=loghub.ProcrunHandler ^
--StartMethod=windowsStart ^
--StopClass=loghub.ProcrunHandler ^
--StopMethod=windowsStop ^
--LogPath="...\\loghub.log" ^
--StdOutput=auto ^
--StdError=autoSome deployments prefer an XML-based configuration consumed by wrapper scripts:
<Service>
<Id>LogHub</Id>
<Name>LogHub</Name>
<Description>LogHub</Description>
<LogPath>...\logs</LogPath>
<Executable>C:\procrun\prunsrv.exe</Executable>
<Options>
<Option name="Jvm">auto</Option>
<Option name="StartMode">jvm</Option>
<Option name="StopMode">jvm</Option>
<Option name="Classpath">...\\loghub.jar</Option>
<Option name="StartClass">loghub.ProcrunHandler</Option>
<Option name="StartMethod">windowsStart</Option>
<Option name="StopClass">loghub.ProcrunHandler</Option>
<Option name="StopMethod">windowsStop</Option>
</Options>
</Service>