Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

LogFile creation  RSS feed

 
vin Hari
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
iam writing a menu driven program which works in client server environment,
know iam creating a logfile(log.txt) at server side which keep track of all the clients which are connecting this is ok working i used FileOutputStream,for that ,but my question is how to get the end of the file how to fix it for ex: i want for 100 lines after writing onto file for 100 lines it should not write anything ,and also after 100 lines automatically it should copy into some temporary files always and start writing the log file from beginning and also i have to keep track of all the actions of client from the login till logout all the actions should be in log file , please give some suggestion how to solve this problem,
this problem looks quite easy to look but not that. please help me.
 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at Log4J, and in particular the RollingFileAppender. This looks at size, but it shouldn't be too hard to look at its code and write something similar for number of lines.
 
vin Hari
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
Thank you for reply,but it is really hard to implement ok i will try it,
but please tell me is there any way i can give the size of the file(For example 100 lines)as EOF for writing onto the file. on by reaching the 100 lines it sbould not write after that, this condition can be used for reading files as read till EOF but how for writing the file.please tell me.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!