Class Debug
java.lang.Object
de.spiritscorp.datasync.io.Debug
Utility class providing centralized logging capabilities for application diagnostics,
errors, and exception tracking. All outputs are automatically enriched with a timestamp
and the active application instance name.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidprintDebug(String format, Object... args) Writes a formatted debugging message to the standard output stream (stdout).static voidprintDebugTimeless(String format, Object... args) A debug method to write a formatted string to this output stream using the specified format string and arguments.static voidprintError(String format, Object... args) Writes a formatted error message to the standard error stream (stderr).static voidprintException(Class<?> clazz, Exception exception) Logs or prints detailed diagnostic information about a caught exception.static voidRedirects diagnostic logging output streams to a local file.
-
Method Details
-
printDebug
Writes a formatted debugging message to the standard output stream (stdout). The output is automatically prefixed with a current timestamp and the running instance name.- Parameters:
format- A format string as described inFormattersyntaxargs- Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by The Java Virtual Machine Specification.
-
printError
Writes a formatted error message to the standard error stream (stderr). The output is automatically prefixed with a current timestamp and the running instance name.- Parameters:
format- A format string as described inFormattersyntaxargs- Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by The Java Virtual Machine Specification.
-
printException
Logs or prints detailed diagnostic information about a caught exception.This utility method formats and outputs the primary exception message, inspects and logs the root cause if present to prevent
NullPointerException, and extracts the complete formatted stack trace for deep debugging.* Example Output Structure:
Exception in Class: [com.example.MyService]:Message -> Connection failed ↳ Cause: java.net.ConnectException -> Message: Connection refused Full Info: java.lang.RuntimeException: Connection failed at com.example.MyService.start(MyService.java:24) ...
-
printDebugTimeless
A debug method to write a formatted string to this output stream using the specified format string and arguments.- Parameters:
format- A format string as described inFormattersyntaxargs- Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by The Java Virtual Machine Specification.
-
setDebugToFile
public static void setDebugToFile()Redirects diagnostic logging output streams to a local file. Once invoked, messages processed by this utility will be appended to the designated log file infrastructure instead of solely printing to the console.
-