Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.4k views
in Java FTP by (240 points)
Recently, I'm working on this app that will search my local directory for files, and upload each of them to a server. I was also told that I need to output the log in a text file for future reference.

Brief explanation on how my app works right now:

-I have a shell script that CDs into all my directories where files are present
-when it finds a file, it will call my java application, which is used to upload those files
-when its done, my shell script carries on in finding other files to upload.

So I got the log to output to a file, which is done in my java app. However, I'm getting a log file for every file that I upload, since I'm calling my java app each time I find a file.

So I was wondering if there is a way to continue the logging in a text file, so that everytime I call the java app, it will continue to log the output in the same file. This way, I will have only one large log file instead of millions of small log files.

Thanks a lot in advance.

awong

[Edit: Typo]

4 Answers

0 votes
by (162k points)
are you using the FileAppender? Why don't you supply the same filename?
0 votes
by (240 points)
I do supply the same filename, its just that I keep changing directories (where my files are). So its creating log files in all those directories where I'm uploading my files.

Now that gives me an idea, is it possible to specify a location when passing the argument? i.e c:/log.txt?

Thanks again.

awong
0 votes
by
Now that gives me an idea, is it possible to specify a location when passing the argument? i.e c:/log.txt?


Sure, if the log-file is local then you can certainly supply the full path and reuse the same file over and over again. You can use the following constructor to make sure you append to the file instead of overwriting it:
FileWriter logFile = new FileWriter("C:\logtxt", true);


- Hans (EDT)
0 votes
by (240 points)
ah it works now, thx a lot :P

Categories

...