I have created a small program which logs text data to a file on some action. I am accessing the remote system where the program is deployed by Putty. I have run the program using nohup so that it keeps running even if i shut down my shell. Till the time i am logged into the shell it continues to log the data. However, as soon as i exit my shell it stops writing to the log file. My program still continues to run just that it doesn't write to the log file. I am using Java 1.6 + slf4j+log4j for logging. The OS is Ubuntu.
Would appreciate some help.
EDIT: my log4j.properties
log4j.rootLogger=DEBUG
log4j.appender.AdminFileAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.AdminFileAppender.File=pdmLogs.log
log4j.appender.AdminFileAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.AdminFileAppender.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} -- %p %t %c - %m%n
log4j.appender.ReportFileAppender=org.apache.log4j.ConsoleAppender
log4j.appender.ReportFileAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ReportFileAppender.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} -- %p %t %c - %m%n
log4j.logger.com.xxx.xxx.yyy=ReportFileAppender,AdminFileAppender
log4j.logger.com.xxx.xxx.zzz=ReportFileAppender,AdminFileAppender
The command which I am running is:
nohup java -cp jarfile.jar com.xxx.xxx.yyy.Main &
Try changing your configuration to:
log4j.rootLogger=DEBUG, AdminFileAppender
...