JavaService append mode instead of truncating log file

Discussion in 'Java' started by uy_do, Dec 3, 2003.

  1. uy_do

    uy_do Guest

    Hi,
    I don't know if this is the right place or not, but after trying google &
    asking Mutiplan guys without any results, I decide to post it here to see if
    anyone ever experienced the same problem.
    I'm developing a java application that is deployed as a service on windows
    2000, and I use JavaService as the tool. It works fine until I find out that
    whenever I restart the service, the log file/error file is truncated instead
    of appending to it and the old information was wiped out. I tried the class
    FileOutputStream(File,append) , but the files(both the log & error files)
    were still truncated.
    The code I use is retyped here as a reference:
    ------------------
    static bool redirectSystemErr(HANDLE hEventSource, JNIEnv *env, char
    *errFile)
    {
    .......
    jobject fileOutputStream = env->NewObject(fileOutputStreamClass,
    fileOutputStreamConstructor, filePathString,true);
    ......
    }
    ------------------
    Is there any way to keep the log or error file and append to it instead
    truncating it when you restart the service?
    Any help is appreciate.
    Uy
     
    uy_do, Dec 3, 2003
    #1
    1. Advertising

  2. 1. boolean in java maps to jboolean in C
    2. Check whether fileOutputStreamConstructor is FileOutputStream(File file,
    boolean append) or FileOutputStream(File file)

    uy_do wrote:
    > Hi,
    > I don't know if this is the right place or not, but after trying
    > google & asking Mutiplan guys without any results, I decide to post
    > it here to see if anyone ever experienced the same problem.
    > I'm developing a java application that is deployed as a service on
    > windows 2000, and I use JavaService as the tool. It works fine until
    > I find out that whenever I restart the service, the log file/error
    > file is truncated instead of appending to it and the old information
    > was wiped out. I tried the class FileOutputStream(File,append) , but
    > the files(both the log & error files) were still truncated.
    > The code I use is retyped here as a reference:
    > ------------------
    > static bool redirectSystemErr(HANDLE hEventSource, JNIEnv *env, char
    > *errFile)
    > {
    > ......
    > jobject fileOutputStream = env->NewObject(fileOutputStreamClass,
    > fileOutputStreamConstructor, filePathString,true);
    > .....
    > }
    > ------------------
    > Is there any way to keep the log or error file and append to it
    > instead truncating it when you restart the service?
    > Any help is appreciate.
    > Uy
     
    Harish Madhavan, Dec 4, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edward E. Sandfort

    JavaService - need help (please!)

    Edward E. Sandfort, Jul 1, 2003, in forum: Java
    Replies:
    3
    Views:
    3,862
    E Sandfort
    Jul 3, 2003
  2. Christiaan

    JavaService & JBoss

    Christiaan, Jan 16, 2004, in forum: Java
    Replies:
    0
    Views:
    648
    Christiaan
    Jan 16, 2004
  3. Replies:
    1
    Views:
    415
    Steve W. Jackson
    Jun 30, 2005
  4. Replies:
    2
    Views:
    2,960
    Roedy Green
    Oct 31, 2005
  5. Alessandro
    Replies:
    1
    Views:
    441
Loading...

Share This Page