javaapache-commonsprocrun

How to disabled logging stdout for apache commons daemon (Procrun)?


I'm using apache commons daemon tool Procrun to install a java command line tool as a windows service.

The java tool displays lots of content on the console during running. Any sysout will automatically be logged by the daemon tool into a logfile. This file cannot be removed as long as the service is running.

Problem: my service and my application should hardly ever be restarted. This results in a daemon StdOutput logfile of several hundred GB per month, which I can only clear manually by stopping the app first.

Question: is it possible to disable this service logging?


Solution

  • You can avoid having your stdout and stderr written to a file by omitting a filename from the configuration script for the --StdOutput and --StdError parameters. I have this working with v1.0.15.0

    For instance:

    D:\prunsrv.exe //IS//SomeService ^
    --DisplayName="SomeService" ^
    --Description="Some Procrun Service" ^
    --Startup=auto ^
    --Install=%CD%\prunsrv.exe ^
    --Jvm=%JAVA_HOME%\jre\bin\server\jvm.dll ^
    --Classpath=%CD%\MyApplication-SNAPSHOT.jar; ^
    --StartMode=jvm ^
    --StartClass=com.myDomain.bootstrap ^
    --StartMethod=start ^
    --StartParams=start ^
    --StopMode=jvm ^
    --StopClass=com.myDomain.bootstrap ^
    --StopMethod=stop ^
    --StopParams=stop ^
    --StdOutput= ^
    --StdError= ^
    --LogPath=%CD%\logs ^
    --LogLevel=Debug ^