How to disable stdout maintenance for apache commons daemon (Procrun)?

I am using apache daemon commons tool Procrun

to install java command line tool as windows service.

The java tool displays a large amount of content on the console while running. Any sysout will be automatically written by the daemon tool to the log file. This file cannot be deleted while the service is running.

Problem: My service and my application are unlikely to ever be restarted. The result is a daemon log file of StdOutput

several hundred GB per month that I can only manually delete by stopping the application first.

Question: can this logging be disabled?

+3


source to share


3 answers


You can avoid writing stdout and stderr to a file by omitting the filename from the config script for parameters --StdOutput

and --StdError

. It works for me since v1.0.15.0

For example:



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 ^

      

+5


source


The best practice for me is a batch file which makes everything very simple for me:

installService.bat



REM Main
set SERVICE_NAME=MyService
set PR_DESCRIPTION=My Description
set PR_INSTALL=C:\procrun-sample-master\prunsrv.exe
set PR_STARTUP=auto

REM Java
set PR_JVM=%JAVA_HOME%\bin\server\jvm.dll
set PR_CLASSPATH=myservice.jar

REM LOG disabled
set PR_LOGPATH=C:\procrun-sample-master\log
set PR_STDOUTPUT=
set PR_STDERROR=
set PR_LOGLEVEL=Warn

REM Start Config
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=package.Classname
set PR_STARTMETHOD=start

REM Stop Config
set PR_STOPMODE=jvm
set PR_STOPCLASS=package.Classname
set PR_STOPMETHOD=stop

REM Install
prunsrv.exe //IS//%SERVICE_NAME%

      

+1


source


To resolve this issue, follow the steps below.

  • Stop apache service via services
  • Open command prompt (cmd) as administrator
  • Go to your tomcat exc file location i.e.

    cd D:\MyApplication\Apache-Tomcat\bin\

  • Run command

    tomcat7.exe //US//JasperGenDoc --StdOutput=

  • Start apache service via services.
0


source







All Articles