org.apache.logging.log4j.io
Class LoggerPrintStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
org.apache.logging.log4j.io.LoggerPrintStream
- All Implemented Interfaces:
- Closeable, Flushable, Appendable
public class LoggerPrintStream
- extends PrintStream
Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
that follows the PrintStream methods in spirit, but doesn't require output to any external stream.
This class should not be used as a stream for an underlying logger unless it's being used as a bridge.
Otherwise, infinite loops may occur!
- Since:
- 2.1
|
Constructor Summary |
protected |
LoggerPrintStream(org.apache.logging.log4j.spi.ExtendedLogger logger,
boolean autoFlush,
Charset charset,
String fqcn,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker)
|
protected |
LoggerPrintStream(OutputStream out,
boolean autoFlush,
Charset charset,
org.apache.logging.log4j.spi.ExtendedLogger logger,
String fqcn,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker)
|
|
Method Summary |
LoggerPrintStream |
append(char c)
|
LoggerPrintStream |
append(CharSequence csq)
|
LoggerPrintStream |
append(CharSequence csq,
int start,
int end)
|
boolean |
checkError()
|
void |
close()
|
void |
flush()
|
LoggerPrintStream |
format(Locale l,
String format,
Object... args)
|
LoggerPrintStream |
format(String format,
Object... args)
|
void |
print(boolean b)
|
void |
print(char c)
|
void |
print(char[] s)
|
void |
print(double d)
|
void |
print(float f)
|
void |
print(int i)
|
void |
print(long l)
|
void |
print(Object obj)
|
void |
print(String s)
|
LoggerPrintStream |
printf(Locale l,
String format,
Object... args)
|
LoggerPrintStream |
printf(String format,
Object... args)
|
void |
println()
|
void |
println(boolean x)
|
void |
println(char x)
|
void |
println(char[] x)
|
void |
println(double x)
|
void |
println(float x)
|
void |
println(int x)
|
void |
println(long x)
|
void |
println(Object x)
|
void |
println(String x)
|
String |
toString()
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
LoggerPrintStream
protected LoggerPrintStream(org.apache.logging.log4j.spi.ExtendedLogger logger,
boolean autoFlush,
Charset charset,
String fqcn,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker)
throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
LoggerPrintStream
protected LoggerPrintStream(OutputStream out,
boolean autoFlush,
Charset charset,
org.apache.logging.log4j.spi.ExtendedLogger logger,
String fqcn,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker)
throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
append
public LoggerPrintStream append(char c)
- Specified by:
append in interface Appendable- Overrides:
append in class PrintStream
append
public LoggerPrintStream append(CharSequence csq)
- Specified by:
append in interface Appendable- Overrides:
append in class PrintStream
append
public LoggerPrintStream append(CharSequence csq,
int start,
int end)
- Specified by:
append in interface Appendable- Overrides:
append in class PrintStream
checkError
public boolean checkError()
- Overrides:
checkError in class PrintStream
close
public void close()
- Specified by:
close in interface Closeable- Overrides:
close in class PrintStream
flush
public void flush()
- Specified by:
flush in interface Flushable- Overrides:
flush in class PrintStream
format
public LoggerPrintStream format(Locale l,
String format,
Object... args)
- Overrides:
format in class PrintStream
format
public LoggerPrintStream format(String format,
Object... args)
- Overrides:
format in class PrintStream
print
public void print(boolean b)
- Overrides:
print in class PrintStream
print
public void print(char c)
- Overrides:
print in class PrintStream
print
public void print(char[] s)
- Overrides:
print in class PrintStream
print
public void print(double d)
- Overrides:
print in class PrintStream
print
public void print(float f)
- Overrides:
print in class PrintStream
print
public void print(int i)
- Overrides:
print in class PrintStream
print
public void print(long l)
- Overrides:
print in class PrintStream
print
public void print(Object obj)
- Overrides:
print in class PrintStream
print
public void print(String s)
- Overrides:
print in class PrintStream
printf
public LoggerPrintStream printf(Locale l,
String format,
Object... args)
- Overrides:
printf in class PrintStream
printf
public LoggerPrintStream printf(String format,
Object... args)
- Overrides:
printf in class PrintStream
println
public void println()
- Overrides:
println in class PrintStream
println
public void println(boolean x)
- Overrides:
println in class PrintStream
println
public void println(char x)
- Overrides:
println in class PrintStream
println
public void println(char[] x)
- Overrides:
println in class PrintStream
println
public void println(double x)
- Overrides:
println in class PrintStream
println
public void println(float x)
- Overrides:
println in class PrintStream
println
public void println(int x)
- Overrides:
println in class PrintStream
println
public void println(long x)
- Overrides:
println in class PrintStream
println
public void println(Object x)
- Overrides:
println in class PrintStream
println
public void println(String x)
- Overrides:
println in class PrintStream
toString
public String toString()
- Overrides:
toString in class Object
write
public void write(byte[] b)
throws IOException
- Overrides:
write in class FilterOutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
- Overrides:
write in class PrintStream
write
public void write(int b)
- Overrides:
write in class PrintStream
Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.