Logger (jTDS API)
Keywords: net.sourceforge.jtds.util.Logger class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jtds.util
Class Logger

    java.lang.Object
      net.sourceforge.jtds.util.Logger

public class Logger
extends java.lang.Object

Class providing static methods to log diagnostics.

There are three ways to enable logging:

1. Pass a valid PrintWriter to DriverManager.setLogWriter().
2. Pass a valid PrintWriter to DataSource.setLogWriter().
3. For backwards compatibility call Logger.setActive();

Version:
  $Id: Logger.java,v 1.11.2.1 2009/08/07 14:02:11 ickzon Exp $
Author:
  Mike Hutchinson

Field Summary
`private static char[]` | `hex`
`private static java.io.PrintWriter` | `log` PrintWriter stream set by DataSource.

Constructor Summary
`Logger()`

Method Summary
`static java.io.PrintWriter` | `getLogWriter()` Get the logging PrintWriter Stream.
`static boolean` | `isActive()` Retrieve the active status of the logger.
`static void` | `logException(java.lang.Exception e)` 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` | `println(java.lang.String message)` Print a diagnostic message to the output stream provided by the DataSource or the DriverManager.
`static void` | `setActive(boolean value)` Deprecated. Use the JDBC standard mechanisms to enable logging.
`static void` | `setLogWriter(java.io.PrintWriter out)` Set the logging PrintWriter stream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static java.io.PrintWriter log

  PrintWriter stream set by DataSource.

### hex

    private static final char[] hex

Constructor Detail

### Logger

    public Logger()

Method Detail

### setLogWriter

    public static void setLogWriter(java.io.PrintWriter out)

  Set the logging PrintWriter stream.

  Parameters:
    `out` - the PrintWriter stream

### getLogWriter

    public static java.io.PrintWriter 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

    public static void println(java.lang.String message)

  Print a diagnostic message to the output stream provided by the DataSource or the DriverManager.

  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 packet
    `in` - true if this is an input packet
    `pkt` - the packet data

### logException

    public static void logException(java.lang.Exception e)

  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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Generated on December 30 2009