com.droplets.util
Class DropletLog

java.lang.Object
  |
  +--com.droplets.util.DropletLog

Deprecated. Use com.droplets.api.util.Log instead.

Provides an interface to the Droplet Server's log file. Java applications can write structured messages to the file. There are four kinds of messages, represented by four symbolic constants, one of which must be passed to each invocation of write:

It is important to note that your application should not write frequent messages to the log. Doing so will cause performance problems for your own application and for others running in the same Droplet Server. This is because one central log file is shared by the Server and all its applications, and access to the log file is synchronized.

Logging never throws an exception. Usually it succeeds, but if it fails for some reason, it fails silently. If, for example, the log file is being written to by another application or thread when you attempt to write to it, your thread will block, but only for a short period of time (< 1 second), after which it will silently discard the log message and return.

This class is a singleton, meaning that only one global (static) instance is ever created. To write to the log, obtain the DropletLog object by calling get(), then call some method on the result. For example:

DropletLog.get().write (DropletLog.WARNING, "myApplication", "watch out, brother");
It is important that applications not cache this instance, but rather re-obtain it for each method call, as shown above. Future implementations of this class may support customizable, configurable logging strategies that will require different objects to be returned under different circumstances.

public class DropletLog
extends java.lang.Object


Field Summary
static int DEBUG
          Deprecated. Pass to write as the messageType to indicate that this is a debug message.
static int ERROR
          Deprecated. Pass to write as the messageType to indicate that the message signals an error.
static int INFO
          Deprecated. Pass to write as the messageType to indicate that the message is purely informative.
static int WARNING
          Deprecated. Pass to write as the messageType to indicate that the message is a warning.
 
Method Summary
static DropletLog get()
          Deprecated. Returns the global singleton instance of DropletLog.
 void write(int messageType, java.lang.String message)
          Deprecated. Writes a message to the Droplet log, using the default subsystem name ("JavaDroplet").
 void write(int messageType, java.lang.String subsystemName, java.lang.String message)
          Deprecated. Writes a message to the Droplet log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final int DEBUG
Deprecated. 
Pass to write as the messageType to indicate that this is a debug message.

ERROR

public static final int ERROR
Deprecated. 
Pass to write as the messageType to indicate that the message signals an error.

INFO

public static final int INFO
Deprecated. 
Pass to write as the messageType to indicate that the message is purely informative.

WARNING

public static final int WARNING
Deprecated. 
Pass to write as the messageType to indicate that the message is a warning.
Method Detail

get

public static DropletLog get()
Deprecated. 
Returns the global singleton instance of DropletLog. Applications should not cache this instance, but rather obtain it for each method call, i.e.:
DropletLog.get().someMethod()
Returns:
the DropletLog object on which logging methods can be called

write

public void write(int messageType,
                  java.lang.String message)
Deprecated. 
Writes a message to the Droplet log, using the default subsystem name ("JavaDroplet"). Note that besides the content of the message itself, there will be no way to tell messages sent from different Droplet Java applications apart. Therefore, it is recommended that you specify a subsystem name by calling write(int, String, String) instead.
Parameters:
messageType - one of the ERROR, WARNING, INFO, or DEBUG symbolic constants. The type of the message will be indicated in the log.
message - the text of the message

write

public void write(int messageType,
                  java.lang.String subsystemName,
                  java.lang.String message)
Deprecated. 
Writes a message to the Droplet log. Use a subsystemName that is specific to your Droplet application so you can tell one application's messages from another's.
Parameters:
messageType - one of the ERROR, WARNING, INFO, or DEBUG symbolic constants. The type of the message will be indicated in the log.
subsystemName - a key that will prefix the message in the log
message - the text of the message


Copyright © Droplets, 2001. All Rights Reserved.