Package net.sourceforge.jtds.util
Class Logger
java.lang.Object
net.sourceforge.jtds.util.Logger
Class providing static methods to log diagnostics.
There are three ways to enable logging:
- Pass a valid PrintWriter to DriverManager.setLogWriter().
- Pass a valid PrintWriter to DataSource.setLogWriter().
- For backwards compatibility call Logger.setActive();
- Author:
- Mike Hutchinson, Holger Rehn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char[]
private static PrintWriter
PrintWriter stream set by DataSource. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PrintWriter
Get the logging PrintWriter Stream.static boolean
isActive()
Retrieve the active status of the logger.static void
Print an Exception stack trace to the log.static void
logPacket
(int streamId, boolean in, byte[] pkt) Print a dump of the current input or output network packet.static void
Print a diagnostic message to the output stream provided by theDataSource
or theDriverManager
.static void
setActive
(boolean value) Deprecated.Use the JDBC standard mechanisms to enable logging.static void
setLogWriter
(PrintWriter out) Set the logging PrintWriter stream.
-
Field Details
-
log
PrintWriter stream set by DataSource. -
hex
private static final char[] hex
-
-
Constructor Details
-
Logger
public Logger()
-
-
Method Details
-
setLogWriter
Set the logging PrintWriter stream.- Parameters:
out
- the PrintWriter stream
-
getLogWriter
Get the logging PrintWriter Stream.- Returns:
- the logging stream as a
PrintWriter
-
isActive
public static boolean isActive()Retrieve the active status of the logger.- Returns:
boolean
true if logging enabled
-
println
Print a diagnostic message to the output stream provided by the
DataSource
or theDriverManager
.- Parameters:
message
- the diagnostic message to print
-
logPacket
public static void logPacket(int streamId, boolean in, byte[] pkt) Print a dump of the current input or output network packet.- Parameters:
streamId
- the owner of this packetin
- true if this is an input packetpkt
- the packet data
-
logException
Print an Exception stack trace to the log.- Parameters:
e
- the exception to log
-
setActive
public static void setActive(boolean value) Deprecated.Use the JDBC standard mechanisms to enable logging.Turn the logging on or off.- Parameters:
value
- true to turn on logging
-