Trying to create log of programs activities

Trying to create a log file that will track what my program is doing but receiving the following error message on my write command:
C:\jakarta-tomcat-4.0.3\webapps\webdav\WEB-INF\classes>javac ReadSource.java
ReadSource.java:28: cannot resolve symbol
symbol : method write (java.lang.String)
location: class java.io.FileOutputStream
fos.write(s);
^
1 error
Here is my program:
import java.io.*;
import java.util.StringTokenizer;
import java.sql.*;
public class ReadSource {
static String filename = "C:/upload/log/logfil.log";
public static void main(String[] args) throws Exception {
     StringTokenizer st1;
          String val1, val3, val4, val5, val9, val10, val11, val12, val13, val14, val16;
          String val2, val6, val7, val8, val15, val17;
          File f = new File("C://upload" );
     try {
          Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxxx.xxxxx.xxxx:1521:xx","xxxxxx","xxxxx");
                    Statement st = conn.createStatement();
                    File fl = new File(filename);
                    if (!fl.exists())
                    { fl.createNewFile(); }
                    FileOutputStream fos = new FileOutputStream(fl.toString(),true);
                    if (f.isDirectory())
                    { String [] s = f.list();
                    for (int i=0; i<s.length; i++)
                    { System.out.println(s[i]);
                         fos.write(s[i]);
                         System.out.println(f);
                              System.out.println(f+"/"+s[i]);
          FileReader file = new FileReader(f+"/"+s[i]);
                              File inputFile = new File(f+"/"+s[i]);
                              File outputFile = new File("C:/upload/archive/"+s[i]);
                    BufferedReader buff = new BufferedReader(file);
                    boolean eof = false;
                    String val0="";
                    ResultSet rec = st.executeQuery("SELECT landings_hold_batch_seq.nextval FROM dual");
                    while(rec.next())
                    { val0 = rec.getString(1);
                         //System.out.println(val0);
                    while (!eof)
                    { String line = buff.readLine();
                         if (line == null)
                         { eof = true; }
                         else
                         { //System.out.println(line);
                              st1 = new StringTokenizer(line,",");
                                   //System.out.println(val0);
                                   val1 = st1.nextToken();
                                   val2 = st1.nextToken();
                                   val3 = st1.nextToken();
                                   val4 = st1.nextToken();
                                   val5 = st1.nextToken();
                                   val6 = st1.nextToken();
                                   val7 = st1.nextToken();
                                   val8 = st1.nextToken();
                                   val9 = st1.nextToken();
                                   val10 = st1.nextToken();
                                   val11 = st1.nextToken();
                                   val12 = st1.nextToken();
                                   val13 = st1.nextToken();
                                   val14 = st1.nextToken();
                                   val15 = st1.nextToken();
                                   val16 = st1.nextToken();
                                   val17 = st1.nextToken();
                                   /*System.out.println("Token 0: " + val0);
                              System.out.println("Token 1: " + val1);
                              System.out.println("Token 2: " + val2);
                                   System.out.println("Token 3: " + val3);
                                   System.out.println("Token 4: " + val4);
                                   System.out.println("Token 5: " + val5);
                                   System.out.println("Token 6: " + val6);
                                   System.out.println("Token 7: " + val7);
                                   System.out.println("Token 8: " + val8);
                                   System.out.println("Token 9: " + val9);
                                   System.out.println("Token 10: " + val10);
                                   System.out.println("Token 11: " + val11);
                                   System.out.println("Token 12: " + val12);
                                   System.out.println("Token 13: " + val13);
                                   System.out.println("Token 14: " + val14);
                                   System.out.println("Token 15: " + val15);
                                   System.out.println("Token 16: " + val16);
                                   System.out.println("Token 17: " + val17);*/
                                   st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive)" +
                    "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL)");
                         FileReader in = new FileReader(inputFile);
                         FileWriter out = new FileWriter(outputFile);
int c;
                         while ((c = in.read()) != -1)
                         { out.write((char)c); }
                         in.close();
                         out.close();
                         //f.delete(); // delete the upload file
                         buff.close();
                    conn.close();
                    else
                    { System.out.println("No files to process"); }
          catch(Exception e) { System.out.println("My Error: " + e); }

Code's too badly formatted to read, but logging is considered an old chestnut these days anyway:
If you're using JDK 1.4, use the java.util.logging package http://java.sun.com/j2se/1.4.1/docs/api/java/util/logging/package-summary.html
If you're using JDK 1.3 or earlir, use Apache log4j http://jakarta.apache.org/log4j/docs/index.html
If you have to run in both old a new VMs, use log4j.

Similar Messages

  • Elements 10 organizer keeps stopping when trying to create a slide program.

    When trying to create a slide program Elements 10 Organizers stops working about half way through the selection.  How can I correct this problem?

    Thanks Lennart for your help...you are the man!
    I tried what you said and was able to import my movie into iDVD although I still had trouble writing the DVD (4 more times) as the titles page viewed with the wrong buttons and the sound was out of synch with the movie.
    I tried once again from within iMovie and clicked the 'proceed' button instead of 'render and proceed' and this seemed to work okay.
    I then went on to create the DVD which worked fantastic.
    Thanks for your help which lead me in the right direction.
    Julie

  • An error occured while trying to create directory C:\Program Files\Common Files

    iTunes and Quicktime kept giving errors when trying to update so I tried to uninstall and re-install but I get the same error and now don't have iTunes. I get multiple errors for c:\program files\common files\apple\apple application support\webkit.resources\ru.lproj and c:\program files\common files\apple\mobile device support\com.apple.windowsmail.client.resources\pt.lproj\localizable.strings. Verify that you have access to that directory.I have tried clearing cache, cookies, etc. Also tried to remove those files but I get another error. I have full administration rights and turned off all security. Any ideas???

    I get multiple errors for c:\program files\common files\apple\apple application support\webkit.resources\ru.lproj and c:\program files\common files\apple\mobile device support\com.apple.windowsmail.client.resources\pt.lproj\localizable.strings. Verify that you have access to that directory.
    I have tried clearing cache, cookies, etc. Also tried to remove those files but I get another error.
    That's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive. There's XP instructions in the following document: How to perform disk error checking in Windows XP
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • I cannot install itunes because of an error while trying to create directory H:\Program Files why is this happening

    I get this message when trying to install itunes, I have tried just about everything but nothing works. I have wiped ALL traces of itunes and started again...no luck...iI tried a 32bit instead of a 64 which is what my pc is rated for...no luck...it was all due to the latest version being released so I tried to upgrade but nothing works. Not even rolling back to a previous version is working.
    Any ideas????

    That one's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive.
    XP instructions in the following document: How to perform disk error checking in Windows XP
    Vista instructions in the following document: Check your hard disk for errors
    Windows 7 instructions in the following document: How to use CHKDSK (Check Disk)
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • Using APT ActiveX methods to create a labview program for BPC 203 3 channel Benchtop Piezo controller

    Hi Everyone,
                      I am really very new to Labview and i am in great need for some help.I am assigned a task where i am supposed to create a labview program to control or moniter a BPC203 3 channel benchtop  Piezo controller. I created a program with the help of the instructions provided in the APT-Labview guide provided by Thorlabs.But th program doesnt run . Whenever i try to run it i get the same error which says that "Control HW Communications disabled".I have attached a snapshot of the error message.So i tried to create a small program in labview which would read the volage output.Even there i got the same error message.I suppose there is some mistake on my part which i am not able to correct due to the lack of proper knowledge.Could anyone please help me to solve this problem.A slight elaboration would be highly appreciated.Also i think the error lies in the use of invoke node with the get Voltage output method. I am not sure whether the parameters i have provided to the invoke node are correct.Any help of any sort would be highly appreciated.
    Attachments:
    Front Panel with error message.PNG ‏202 KB
    Block diagram.PNG ‏101 KB

    Hi
    I had the same problem today. However, I noticed that the piezo controller has 3 channels with separate slots and they are packaged in the same box. Therefore the whole box has a serial number, probably something like 71822280, and this is written with large letter. Now, in order to communicate with any of the channels, this does not help, but one needs to communicate directly with the interested channel and they have thier OWN SERIAL NUMBERS.
    For example channel 1 (my X direction in the nanoMax stage) has serial 91822281, Y has 91822282 and Z has 91822283. So try looking if you have the right serial number Hopefully you found out this yourself but this might help others, I took me3 hours to get this thing working when I started to plug-in the cables and everything.
    Lasse

  • Create log on to eprint center get error message: Ajax submit failed: error= 403,Forbidden

    I am trying to access this through Firefox. I have an HP Photosmart D110a printer. This happens whether I try to log on as well as trying to create log on.
    This question was solved.
    View Solution.

    Hey, I would try a different browser, like IE or Google Chrome, it is the easiest solution. You could also clear the history ,cookies and the cache from the current browser that you are getting the error message on. Restarting the computer is another option to try too. I hope this helps. 
    I am a former employee of HP...
    How do I give Kudos?| How do I mark a post as Solved?

  • Trying to create .pdfs but getting .log instead

    In trying to create .pdf files using Acrobat Standard 9 from different programs (Excel, Word, Internet Explorer), an empty .log file is created but no .pdf. I'm not sure what changed; it used to work just fine.

    You might also try a print to file and then open the file in Distiller. That should show you the log items on screen. I only say this since you mentioned an empty log.

  • Trying to create a simple database program.....help, please

    I am trying to create a database and I am having trouble gettig my code correct..........I think I am on the right track but I haven't a clue from this point, can anyone point me in the right direction as far as getting my program to have a master file and a transaction file and be able to manipulate the data........records.
    import java.awt.*;
    import java.applet.*;
    public class recordsApplet
    // Declare variables
    String lstName;
    String frstName;
    Int socSec;
    String street;
    String city;
    String state;
    Int zip;
    float rate;
    Int numofdep;
    //The buttons =
    Button Submit = new Button("Add");
    Button Change = new Button("Change");
    Button Delete = new Button("Delete");
    submit.addActionListner(this);
    Change.addActionListener(this);
    Delete.addActionListener(this);
    //get input from users
    System.out.println("Last Name:")
    lstName = dataIn.readline();
    System.out.println("First Name:")
    frstName = dataIn.readline();
    System.out.println("Social Security #:")
    socSec = dataIn.readline();
    System.out.println("Last Name:")
    street = dataIn.readline();
    System.out.println("Last Name:")
    city = dataIn.readline();
    System.out.println("Last Name:")
    state = dataIn.readline();
    System.out.println("Last Name:")
    zip = dataIn.readline();
    System.out.println("Rate of Pay:")
    rate = dataIn.readline();
    System.out.println("Number of Dependants:")
    numofdep = dataIn.readline();
    public void main(String[] args)
    //store the information in a text file
    try
    output = DataOutputStream(new FileOutputStream("mocdb.txt"));
    catch(IOException er)
    system.exit(0)
    //Print fields to text file
    String arg = e.getActionCommand();
    String code;
    if (arg == "Submit")
    code = "A";
    elseif
    code = "C";
    else
    code = "D";
    try
    output.writeUTF(code);
    output.writeUTF(lstName.getText());
    output.writeUTF(frstName.getText());
    output.writeUTF(socSec.getText());
    output.writeUTF(street.getText());
    output.writeUTF(city.getText());
    output.writeUTF(state.getText());
    output.writeUTF(zip.getText());
    output.writeUTF(rate.getText());
    output.writeUTF(numofdep.getText());
    catch(IOException c)
    System.exit(1);
    //Retrieve record from file
    System.out.println("Last Name:")
    lstName = dataIn.readline();
    System.out.println("First Name:")
    frstName = dataIn.readline();
    try
    record = new DataInputStream(new FileInputStream("mocdb.txt");
    catch(IOException c)
    system.exit(2)
    //Check first and last name and get file
    //Change data in file
    //Delete the data in file

    Sorry, but your question has nothing to do with JavaHelp. Please use another forum.
    /Mauritz

  • The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    Click on the Layout button lower right and choose a Vertical lyout from the dropdown

  • Trying to write an Automator program to find files with same time created and change file names to matching source folder names

    I am failrly green when it comes to automator.
    I am trying to write an Automator program:
    Not sure where to post this
    trying to write an Automator program to find files and alter their names
    I have a source folder with correct named master files in it.
    eg. A0001_1234.mpeg
    time created 14:02:03
    date 07/07/2012
    Another folder where there will be copies of the master files in a different format with different names but created at the same time as a file in the source directory.
    they are created with a seperate device but they are
    A0000001.mp4
    time created 14:02:03
    date 07/07/2012
    I need it to then take the name from the source fies and apply the correct name to the matching file based on the time it was created.
    I can't seem to find actions in automator that reference time crated.
    Is this something I will be able to Do in automator?
    Any help would be great
    Thanks
    R

    Hi,
    It's impossible to do this without any script in Automator.
    Use this AppleScript script :
    set source to choose folder with prompt "Select the source folder"
    set anotherfolder to choose folder with prompt "Choose the another folder"
    tell application "Finder"
        repeat with tfile in (get files of source)
            set cDate to creation date of tfile
            set findFiles to (files of anotherfolder whose creation date is cDate)
            if findFiles is not {} then
                set tName to name of tfile
                set name of item 1 of findFiles to tName
            end if
        end repeat
    end tell

  • Hello, I trying to create a program that would run a household furnace. I can't find a way to set timers for the ignitor,flame sensor and blowers. Any thoughts.

    Hello, I'm trying to create a program that would run a household furnace. I can't find a way to set timers foe the ignitor,flame sensor and blowers. Any thoughts would be greatly appreciated. Thanks, primetime

    In the detailed help for the event structure there is a link to caveats and recommendations for using event structures.  It is a good starting point.
    It is courteous to let the Forum know when your questions are related to a school assignment or homework.  We are glad to help you learn LabVIEW, but do not do your homework for you.
    You have learned the major disadvantage of the sequence structure: It must run to completion before anything else can happen.
    If you are building a state machine (typically a while loop with shift registers enclosing a case structure with one case per state) and having trouble with timing, then think about your requirements. Apparently you have some time delays, but under certain conditions you must terminate a delay/wait and do something else.  One way of doing this is to have a Wait state.  The wait state has a short delay, determined by the minimum time you can delay responding to a changed condition, and a check to see if the required elapsed time has occurred.  If the time has not elapsed, the next state is the Wait state again.  The state machine can repeat any state as often as necessary.  So a 15 second delay could be implemented by going to a Wait state with a one second wait 15 times. Any error or new command will see a response in no more than one second.
    Lynn

  • Hi everybody, I am trying to create a DVD pal without menu with the program iDVD from a .mov file. Any ideas? Thanks so much.

    Hi everybody, I am trying to create a DVD pal without menu with the program iDVD from a .mov file. Any ideas? Thanks so much.

    (From fellow poster Mishmumken: )
    How to create a DVD in iDVD without menu (there are several options):
    1. Easy: Drop your iMovie in the autoplay box in iDVD's Map View, then set your autoplay item (your movie) to loop continously. Disadvantage: The DVD plays until you hit stop on the remote
    2. Still easy: If you don't want your (autoplay) movie to loop, you can create a black theme by replacing the background of a static theme with a black background and no content in the dropzone (text needs to be black as well). Disadvantage: The menu is still there and will play after the movie. You don't see it, but your disc keeps spinning in the player.
    3. Still quite easy but takes more time: Export the iMovie to DV tape, and then re-import using One-Step DVD.
    Disadvantage: One-Step DVD creation has been known to be not 100% reliable.
    4. (My preferred method) Easy enough but needs 3rd party software: Roxio Toast lets you burn your iMovie to DVD without menu - just drag the iMovie project to the Toast Window and click burn. Disadvantage: you'll need to spend some extra $$ for the software. In Toast, you just drop the iMovie project on the Window and click Burn.
    5. The "hard way": Postproduction with myDVDedit (freeware)
    Tools necessary: myDVDedit ( http://www.mydvdedit.com )
    • create a disc image of your iDVD project, then double-click to mount it.
    • Extract the VIDEO_TS and AUDIO_TS folders to a location of your choice. select the VIDEO_TS folder and hit Cmd + I to open the Inspector window
    • Set permissions to "read & write" and include all enclosed items; Ignore the warning.
    • Open the VIDEO_TS folder with myDVDedit. You'll find all items enclosed in your DVD in the left hand panel.
    • Select the menu (usually named VTS Menu) and delete it
    • Choose from the menu File > Test with DVD Player to see if your DVD behaves as planned.If it works save and close myDVDedit.
    • Before burning the folders to Video DVD, set permissions back to "read only", then create a disc image burnable with Disc Utility from a VIDEO_TS folder using Laine D. Lee's DVD Imager:
    http://lonestar.utsa.edu/llee/applescript/dvdimager.html
    Our resident expert, Old Toad, also recommends this: there is a 3rd export/share option that give better results.  That's to use the Share ➙ Media Browser menu option.  Then in iDVD go to the Media Browser and drag the movie into iDVD where you want it.
    Hope this helps!

  • Im trying to create this program but I'm a little stuck

    Hey guys I'm trying to create this program but I'm a little bit stuck. Thanks for the help. Im trying to create a program that prompts the user for a string, then it takes the string adds 2 to the unicode value, and returns that as the output so for example:
    hello there
    turns into
    jgnnq vjgtg
    Thanks for your help

    Hey guys I'm trying to create this program but I'm a
    little bit stuck. Thanks for the help. Im trying to
    create a program that prompts the user for a string,
    then it takes the string adds 2 to the unicode value,
    and returns that as the output so for example:
    hello there
    turns into
    jgnnq vjgtg
    Thanks for your helpYou didn't add 2 to the space character, so is that to be treated special?
    Anyway, you have a String. That String has a length() to tell you how long of a loop you have to do. That String also has a charAt(index) method to give you a character while you're looping thru it. And I assume you know how to add 2 to a character value, and append that character to a new String or StringBuilder or StringBuffer until you're done with the loop.

  • I can't log into Tumblr.I'm trying to creat a account there.It goes tosecond stage when asking year and confirmation.After thatstage it is not responding furthe

    I can't log into Tumblr.I'm trying to create a account there.It goes to second stage when asking year and confirmation.After that stage it is not responding further.And I am using win 32 bit with Mozilla 30 version.Please help me some one.bye

    Many site issues can be caused by corrupt cookies or cache.
    * Clear the Cache
    '''[https://support.mozilla.org/en-US/kb/how-clear-firefox-cache?redirectlocale=en-US&redirectslug=clear-cache-delete-temporary-files-fix-issues How to clear the Firefox cache]''' {web link}
    and
    * Remove Cookies
    ''This will log you out of all sites you're logged in to. ''
    Press the '''<Alt>''' or '''<F10>''' key to bring up the tool bar.
    Followed by;
    Windows; '''Tools > Options'''
    Linux; '''Edit > Preferences'''
    Mac; ''application name'' '''> Preferences'''
    Then '''Privacy.'''
    Under '''History''', select Firefox will '''Use Custom Settings'''.
    There is a button on the right side called '''Show Cookies'''.
    If there is still a problem,
    '''''[https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode Start Firefox in Safe Mode]''''' {web link}
    While you are in safe mode;
    Press the '''<Alt>''' or '''<F10>''' key to bring up the tool bar.
    Followed by;
    Windows; '''Tools > Options'''
    Linux; '''Edit > Preferences'''
    Mac; ''application name'' '''> Preferences'''
    Then '''Advanced > General.'''
    Look for and turn off '''Use Hardware Acceleration'''.
    Poke around safe web sites and see if there is still a problem. Then restart.

  • I am trying to create another email account with talk talk. and I keep getting a failed message saying 'mail could not log into the mail server talk talk. Yet I already have another email account with talk talk. Not sure what I am doing wrong

    I am trying to create another email account with Talktalk. I already have one account.
    I try to input the new email address and password and get a failed message
    'Mail could not lot into the mail server talktalk.net.
    I have tried several times and keep getting the same message.
    Any ideas

    Accessing your emails from any computer connected to the Internet or from a Smart phone should be straightforward.
    For help on how to set up your e-mail on some of the most common software applications and devices, see How do I set up my TalkTalk email?
    If your software application or device isn't listed, all you need to connect to your TalkTalk e-mail mailbox are the TalkTalk e-mail settings. Make sure you use the right email settings for your specific email address.
    TalkTalk email addresses only
    Login / Username
    [email protected]
    [email protected]
    Incoming mail server
    mail.talktalk.net
    mail.talktalk.net
    Incoming Port
    110
    143
    Outgoing mail server
    smtp.talktalk.net
    smtp.talktalk.net
    Outgoing Port
    587
    587
    Outgoing SSL
    Yes
    Yes
    Outgoing Authentication
    Yes
    Yes

Maybe you are looking for

  • Pin connector of ze2308wm notebook ac adapter gets too hot

    My pin connector of my ac adapter gets too hot whenever I'm working on my ze2308 wm notebook.  It doesn't whenever I set it on "Standby."  Is this normal like that of ac adapter?

  • OnEnterFrame

    I have a basic question about the onEnterFrame event handler. I understand how this code will continually repeat the output trace text: onEnterFrame = function () { trace ("onEnterFrame called"); but why does this only output the trace text once and

  • How to copy links for applications

    How do I copy links for applications? I do this and nothing happens. Where does it go❓      

  • Not able to connect to Oracle Data source in Oracle Essbase Studio 11.1.2.2

    Hi, When i tried to connect to Oracle data source, i get this error "Unable to establigh connection. Ensure that the server is running, the user name and password are correct, and the ohter data fields match the server's configuration" when i tried t

  • Add French input language

    Good day, I would like to add French input language to my BB Pearl 8130. It currently has English (US and UK) installed. I looked through some of the posts in this forum and I understand that I need to download a file and then install it on the black