title: Java Service Wrapper and log4j
body: <p>I am using the Java Service Wrapper to create a Windows Service from a Java Program. </p>
  
  <p>Everything works fine, except the wrapper does not log to a file (I'm using log4j). The logging works properly when the project does not run as a service.</p>
  
  <p>This is not a Log4J problem, because I can log to console with success (this gets redirected to the wrapper's log file), but is not what I'm attempting to achieve. </p>
  
  <p>Here's my wrapper's config file:</p>
  
  <pre><code>    encoding=UTF-8
      #include ../conf/wrapper-license.conf 
      wrapper.lang.folder=../lang 
      # Java Configuration.
      wrapper.java.command=java
      wrapper.java.command.loglevel=INFO
      wrapper.logfile.rollmode=NONE 
      wrapper.java.mainclass=servicewrapper.MainServiceWrapper 
      wrapper.java.classpath.1=../lib/*.jar
      wrapper.java.classpath.2=../lib/classes/*.jar
      wrapper.java.library.path.1=../lib
      wrapper.java.additional.auto_bits=TRUE 
      wrapper.app.parameter.1=servicewrapper.MainServiceWrapper 
      # Logging Configuration 
      wrapper.console.format=PM 
      wrapper.logfile=../logs/wrapper.log 
      # Service Configuration 
      wrapper.name=myproject
      wrapper.check.deadlock=TRUE 
      wrapper.check.deadlock.interval=10 
      wrapper.check.deadlock.action=RESTART 
      wrapper.check.deadlock.output=FULL 
      wrapper.console.title=myproject
      wrapper.ntservice.dependency.1= 
      wrapper.ntservice.starttype=AUTO_START 
      wrapper.ntservice.interactive=false 
  </code></pre>
  
  <p>Also here's my Log4J config file:</p>
  
  <pre><code>log4j.rootCategory=INFO, R
  
  log4j.logger.com.dappit.Dapper.parser=ERROR
  log4j.logger.org.w3c.tidy=FATAL
  log4j.logger.org.hibernate=ERROR
  log4j.logger.org.hibernate.type=ERROR
  log4j.logger.com.mchange.v2.c3p0=ERROR
  log4j.logger.myproject=DEBUG
  
  #------------------------------------------------------------------------------
  #
  #  The following properties configure the console (stdout) appender.
  #  See http://logging.apache.org/log4j/docs/api/index.html for details.
  #
  #------------------------------------------------------------------------------
  log4j.appender.S = org.apache.log4j.ConsoleAppender
  log4j.appender.S.layout = org.apache.log4j.PatternLayout
  log4j.appender.S.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} [%t] %p %c{1} %m%n
  
  #------------------------------------------------------------------------------
  #
  #  The following properties configure the Daily Rolling File appender.
  #  See http://logging.apache.org/log4j/docs/api/index.html for details.
  #
  #------------------------------------------------------------------------------
  log4j.appender.R = org.apache.log4j.RollingFileAppender
  log4j.appender.R.MaxFileSize=10MB
  log4j.appender.R.MaxBackupIndex=10
  log4j.appender.R.File = myproject.log.txt
  log4j.appender.R.Append = true
  log4j.appender.R.layout = org.apache.log4j.PatternLayout
  log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} [%t] %p %c{1} %m%n
  </code></pre>