log4jprocrun

Procrun and log4 configuration


I'm using procrun to start a Windows Service for my java process. I can get the service to start, but the log4j configuration that I set up doesn't seem to be working. This is what I see in the stderr file that procrun creates:

log4j:WARN No appenders could be found for logger (com.jar.aa.MainEntry).
log4j:WARN Please initialize the log4j system properly.

Here is the command that I specify to install the service:

%INSTALL_SERVICE_CMD% //IS//SERVICEAGENT --DisplayName="DispName" --Install=%SERVICE_EXE_HOME%\prunsrv.exe --LogPath=%INSTALLER_HOME% --LogLevel=Info --StdOutput=auto --StdError=auto --StartMode=Java --StopMode=Java --Jvm=auto --Startup=auto --JvmMx=512 ++JvmOptions=-XX:MaxPermSize=128m --StartPath=%START_CLASS_PATH%\ --Classpath=%CLASSPATH%;MyJar.jar --StartClass=com.jar.aa.MainEntry --StopClass=com.jar.aa.ExitEntry ++StopParams=--stop ++JvmOptions=-Dfile.encoding=UTF8 ++JvmOptions=-Dlog4j.configuration=log4j.properties ++JvmOptions=-Dorg.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl

I have my log4j properties placed in the same directory as this install script.

Can anyone tell me what I might be missing? Any help would be greatly appreciated.

Thanks,
K


Solution

  • I'm not sure if my memories are correct, but i think i had the same problem and solved it by including the log4j configuration file in my jar file. In your case MyJar.jar.

    If it still gives troubles try placing your jar at the beginning of your classpath definition. HTH