开发者

Log file locking issues in Batch scripting

I have a batch file which starts a Java server class. The output of the Java is redirected to a log file. This batch file is stared via a windows service. Problem is this log file is becoming very huge. Since the Java server is running, it is not possible to do any modification in the Log file as it is locked. How can I create a new log file for every day?

My idea was to write another batch file which will stop the service, backup the existing log file, delete and start the 开发者_JAVA百科service file again. Is this approach correct?

java -Xms32m -Xmx256m gtServer >> abclog.txt

Above is the code in the batch file which starts the sever

Any tips on how we could back up the file without stopping the java server?

Thanks in advance

Karthik


Heard about log4j?

Ok, seriously, would it be possible to use some proper logging facility? It usually provides something for this purpose like RollingFileAppender.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜