I have Tomcat 7 configured to run as Windows Service. I am using SLF4J for logging. Logs are getting captured properly.
Only problem I have is when I restart Tomcat Service it purge the old logs, even if .
It seems this is Tomcat's default behavior when running as Windows Service.
Is it possible to change this behavior, I want whenever service gets restarted, it just append the new logs, instead of purging the old logs.
I don't see why it would clean up the contents of the server.log file with the "append" set to true. Are you sure that's the only appender which refers to that server.log file? Maybe you have another configuration within that log4j file (or some other log4j configuration file which might be getting picked up) which has a different appender configuration for server.log?
Ravinderjit Singh wrote:
How and where do those PR_STDOUTPUT and PR_STDERROR get used? Given the names of those variables, it's possible that whoever/wherever those are being used clears off the file contents during a restart.
--StdOutput Redirected stdout filename. If named auto then file is created inside LogPath with the name service-stdout.YEAR-MONTH-DAY.log.
--StdError Redirected stderr filename. If named auto then file is created inside LogPath with the name service-stderr.YEAR-MONTH-DAY.log.
I'm guessing that the script uses > to redirect instead of >> which is understandable for console/error stream redirection. My suggestion is you use different file(s) for the console/error stream logs. So change those 2 variables to something like: