aspose file tools*
The moose likes Other Open Source Projects and the fly likes Log4j created file not able to delete while testing my application?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j created file not able to delete while testing my application?? " Watch "Log4j created file not able to delete while testing my application?? " New topic
Author

Log4j created file not able to delete while testing my application??

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
Hi,

I am using Apache- tomcat Webserver on my Windows machine

1)
In my web-based application i am using log4j for debugging my application.But the problem i m facing is that whenever i have to delete the logs generated while the Tomcat Server is on that is i am testing my application, i am able to delete the logs but not able to save the file so all the logs i deleted diplays again plus the new one generated.The system
says the file is in use?? So i have to shutdown my tomcat & then the file gets saved .So how to get rid of this problem ??

Also how can i generate different files whenever i start my application so that i dont have to refer my old file for the logs.Does it need any extra configuration in my properties file i m using for log4j??

My properties file is like this.....




2)
One more thing i am generating some csv files from my application but they doesn't get deleted while my server remains ON. This should not happen as my application will be used by many users through web..

What i want to do is create the csv files actually they are a form of reports so each individual user should be able to generate report in the file system of their own PC.Currently my files are getting generated on the fileSystem where i m developing my application, ie on server's file system...

So help me sort out these two queries...

Thanks,
Jignesh


Regards,
Jignesh

The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42274
    
  64
I don't think log4j has an appender that creates a new file every time a web app is restarted. You could use DailyRollingFileAppender with a short time frame, or create a subclass of RollingFileAppender that does this.

As to the CSV files, why don't you keep track of which files get created, and when, and then delete old files periodically after a certain amount of time?


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Log4j created file not able to delete while testing my application??