com.adventnet.afp.log
Class LogPrintStream
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--java.io.PrintStream
|
+--com.adventnet.afp.log.LogPrintStream
- public class LogPrintStream
- extends java.io.PrintStream
This class will direct all the system out and system err log messages to the files mentioned
under the SYS_OUT and SYS_ERR tags respectively. These tags are similar to LOG_WRITER tag in the
file conf/logging.xml. The system out and system err properties will be retreived from
the class XMLLogReader. The message "Logging Started" will be displayed for every start of the new file.
The message "Logging Continued" will be displayed when the file is changed. The current log file
will be always the stdout.txt and stderr.txt . Only the previous files will be incremented.
The line count and the file count is maintained in each and every log files stdout and stderr.
After initializing this class, the further System.out and System.err calls will move the corresponding
messages to the files stdout and stderr respectively under logs directory.
Fields inherited from class java.io.FilterOutputStream |
out |
Method Summary |
static void |
closePrintStream()
This method will close both the SYS_OUT and SYS_ERR streams that are opened. |
static void |
init(java.lang.String homeDir,
java.lang.String configurationFileName)
This method obtains all the properties for the SYS_OUT and SYS_ERR from the file
XMLLogReader. |
void |
print(boolean message)
|
void |
print(char message)
|
void |
print(char[] message)
|
void |
print(double message)
|
void |
print(float message)
|
void |
print(int message)
|
void |
print(long message)
|
void |
print(java.lang.Object message)
|
void |
print(java.lang.String message)
|
void |
println()
|
void |
println(boolean message)
|
void |
println(char message)
|
void |
println(char[] message)
|
void |
println(double message)
|
void |
println(float message)
|
void |
println(int message)
|
void |
println(long message)
|
void |
println(java.lang.Object message)
|
void |
println(java.lang.String message)
|
static void |
setErr(java.lang.String header)
This method will open the new print stream for the System err messages. |
static void |
setOut(java.lang.String header)
This method will open the new print stream for the System out messages. |
static void |
setSysErrProps(java.util.Properties errProp)
This method will set all the system err properties to their respective variables. |
static void |
setSysOutProps(java.util.Properties outProp)
This method will set all the system out properties to their respective variables. |
Methods inherited from class java.io.PrintStream |
checkError, close, flush, setError, write, write |
Methods inherited from class java.io.FilterOutputStream |
write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
init
public static void init(java.lang.String homeDir,
java.lang.String configurationFileName)
throws LogException
- This method obtains all the properties for the SYS_OUT and SYS_ERR from the file
XMLLogReader. This method does all the initialization work getting all the system properties
and setting the properties. If the values for the corresponding property is null, then
the default porperty will be set.
- Parameters:
homeDir
- It will get the home directory.configurationFileName
- It will get the configuration file names(For example, logging.xml).- Throws:
LogException
- if an error occurs during initialization
setSysOutProps
public static void setSysOutProps(java.util.Properties outProp)
throws LogException
- This method will set all the system out properties to their respective variables.
Various properties of the SYS_OUT are Maximum line count, maximum file count, logging status
and usetimestamp. At runtime, these properties can be changed and set.
- Parameters:
outProp
- SYS_OUT properties are passed.- Throws:
LogException
- if an error occurs during setting of the SYS_OUT properties.
setSysErrProps
public static void setSysErrProps(java.util.Properties errProp)
throws LogException
- This method will set all the system err properties to their respective variables.
Various properties of the SYS_ERR are Maximum line count, maximum file count, logging status
and usetimestamp. At runtime, these properties can be changed and set.
- Parameters:
errProp
- SYS_ERR properties are passed.- Throws:
LogException
- if an error occurs during setting of the SYS_ERR properties.
println
public void println(java.lang.String message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(java.lang.Object message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(long message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(int message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(float message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(double message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(char[] message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(char message)
- Overrides:
println
in class java.io.PrintStream
println
public void println(boolean message)
- Overrides:
println
in class java.io.PrintStream
println
public void println()
- Overrides:
println
in class java.io.PrintStream
print
public void print(java.lang.String message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(java.lang.Object message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(long message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(int message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(float message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(double message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(char[] message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(char message)
- Overrides:
print
in class java.io.PrintStream
print
public void print(boolean message)
- Overrides:
print
in class java.io.PrintStream
closePrintStream
public static void closePrintStream()
throws LogException
- This method will close both the SYS_OUT and SYS_ERR streams that are opened.
- Throws:
LogException
- if an error occurs while closing the streams.
setOut
public static void setOut(java.lang.String header)
throws LogException
- This method will open the new print stream for the System out messages. The file mentioned
under the tag SYS_OUT will be opened and the system out messages are directed to this file.
Each time the file reaches the maximum line count, the new file will be opened. The current
file will always be stdout.txt whereas the previous files will be incremented. Each time the new
print stream is opened for a file, the total number of files of same type will be checked
whether maximum file is reached. when the maximum file count is reached, the older files will
be deleted.
- Parameters:
header
- The header is printed at the top of the new file .- Throws:
LogException
- If an error occurs during initialization of stdout stream
setErr
public static void setErr(java.lang.String header)
throws LogException
- This method will open the new print stream for the System err messages. The file mentioned
under the tag SYS_ERR will be opened and the system err messages are directed to this file.
Each time the file reaches the maximum line count, the new file will be opened. The current
file will always be stderr.txt whereas the previous files will be incremented. Each time the new
print stream is opened for a file, the total number of files of same type will be checked
whether maximum file count is reached. when the maximum file count is reached, the older files will
be deleted.
- Parameters:
header
- The header is printed at the top of the new file.- Throws:
LogException
- If an error occurs during initialization of stderr stream
Copyright (c)AdventNet Inc., 1996-2004