Package org.jppf.logging
Class OutputToLoggerRedirector
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
org.jppf.logging.OutputToLoggerRedirector
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Redirect
System.out.println() calls to an SLF4J-based logger.- Author:
- Laurent Cohen
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddisable()Disable forwarding to the logger resetting the standard output to the console.static voidenableForClass(Class<?> clazz) Enable forwarding System.out.println calls to the logger if the stacktrace contains the class parameter.static voidenableForPackage(String packageToLog) Enable forwarding System.out.println calls to the logger if the stacktrace contains the package parameter.voidMethods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, write, write, writeBytesMethods inherited from class java.io.OutputStream
nullOutputStream
-
Method Details
-
enableForClass
Enable forwarding System.out.println calls to the logger if the stacktrace contains the class parameter.- Parameters:
clazz- the class whose output to redirect.
-
enableForPackage
Enable forwarding System.out.println calls to the logger if the stacktrace contains the package parameter.- Parameters:
packageToLog- the name of the package whose output to redirect.
-
disable
public static void disable()Disable forwarding to the logger resetting the standard output to the console. -
println
- Overrides:
printlnin classPrintStream
-