• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

see below:

The system says the file is in use??


The problem is that the server, more exactly the log4js' appender has a write lock on your file. So while the appender is not closed, you cannot delete the file. A solution would be you generated smaller files, or to set the append flag to false, so when you restart your server, the old log file is deleted automatically.

I am as well trying to find a solution to have a new log file when server restarts, and as well keep the old one, all this from log4j configuration file. If you find a solution, please share it.

Regards,
Norbert
 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Norbert thanks for the reply.

So how to set this append flag to false because i dont know??

Jignesh
 
Norbert Toth-Gati
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, you have to modify this property in your log4j configuration file:
<param name="Append" value="true"/>

When you set it to false, at restart of application server the file is emptied.

Regards,
Norbert
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic