Results 1 to 4 of 4

Thread: Java Logging

  1. #1
    vignesh is offline Member
    Join Date
    Aug 2007
    Posts
    2
    Rep Power
    0

    Default Java Logging

    Hi All,
    I have a problem using java logging. I have currently set the handler to FileHandler to redirect all my logs to a log file. And in some cases I have to redirect that particular log to the java console. I couldn't able to do that even if I reset the handler to ConsoleHandler.
    How do I manage to use two different handlers alternatively when required? That is sometimes I might require to redirect the log to java console and in some cases to a log file.
    If anybody knows the solution please reply me.
    I appreciate your time.
    Thanks,
    -- Vignesh.

  2. #2
    henry_78 is offline Member
    Join Date
    Aug 2007
    Posts
    47
    Rep Power
    0

    Default

    Hi,
    I think u have to take a look to the System class in java, it provides a way to ridirect streams from and to standard input(System.in) and standard output(System.out).
    I think that will help u..Bye.

  3. #3
    vignesh is offline Member
    Join Date
    Aug 2007
    Posts
    2
    Rep Power
    0

    Default Java Logging

    Thanks for ur reply.
    Still I have problem. Since I have rebinded stderr to logger as
    System.setErr( new PrintStream( stderrLOS, true ) );
    and i did the same for stdout too.
    So all my stdout and stderr msgs will be redirected to log file.
    NOw i have to reset it to normal, ie. I have to send those msgs to java console instead of log file. Do u have any idea about it?
    Thank u for ur time.
    -- Vignesh.

  4. #4
    henry_78 is offline Member
    Join Date
    Aug 2007
    Posts
    47
    Rep Power
    0

    Default

    Hi,
    To reset to norma all u have to do is :
    System.setErr(System.err);
    System.setOut(System.out);
    Bye.

Similar Threads

  1. Logging applications
    By ravian in forum New To Java
    Replies: 2
    Last Post: 01-02-2008, 07:43 PM
  2. what is logging
    By Thirumalt in forum Java Software
    Replies: 1
    Last Post: 11-26-2007, 12:37 PM
  3. X11.Toolkit logging out of control
    By gjsalazar in forum AWT / Swing
    Replies: 0
    Last Post: 11-21-2007, 12:42 AM
  4. Logging
    By ravian in forum New To Java
    Replies: 3
    Last Post: 11-18-2007, 11:22 PM
  5. Java Logging
    By vaswin in forum Advanced Java
    Replies: 0
    Last Post: 08-06-2007, 02:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •