All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.server.ServiceLog

java.lang.Object
   |
   +----sun.server.ServiceLog

public class ServiceLog
extends Object
implements Observer
Create a configured log for a service.

Useage of this class would be as follows: Please note that the example code needs a little more work to be clear:

Assuming the following property file is read via ServiceConfiguration:

log.chatlog.destination=file
log.chatlog.file.filename=log/chat_log
log.chatlog.level=2
log.chatlog.formatclass=sun.server.util.TraceLog
Then this code:
class ChatServiceLog {
String logName = "chatlog";
ServiceConfiguration serviceConfig;
ServiceLog svcLog;
TraceLog chatLog;
ExProperties props;
ChatServiceLog(ServiceConfiguration serviceConfig, String serviceRoot) {
svcLog  = new ServiceLog(logName,serviceConfig,serviceRoot);
chatLog = (TraceLog)svcLog.getLog();
chatLog.write("Log configured");
}
}
Will produce a file in the log directory under service root, named chat_log, which will contain the line written.


Constructor Index

 o ServiceLog(String, ServiceConfiguration, String)
Create a configured log for a service, using the supplied properties.

Method Index

 o close()
Close the service log.
 o configureLog(boolean)
 o getFileName()
Returns the filename associated with the ServiceLog.
 o getHost()
Returns the hostname associated with the ServiceLog.
 o getLog()
Returns the Log associated with this ServiceLog.
 o getName()
Returns the short name of the ServiceLog.
 o getPort()
Returns the port number associated with the ServiceLog.
 o update(Observable, Object)
Routine called when properties are updated by the Observable object.

Constructors

 o ServiceLog
 public ServiceLog(String name,
                   ServiceConfiguration serviceConfig,
                   String serviceRoot) throws IOException
Create a configured log for a service, using the supplied properties.

Methods

 o getName
 public String getName()
Returns the short name of the ServiceLog. (i.e. "access", "proxy", "user".)

 o getLog
 public Log getLog()
Returns the Log associated with this ServiceLog.

 o getFileName
 public String getFileName()
Returns the filename associated with the ServiceLog. Returns null if the ServiceLog is not writing to a file.

 o getHost
 public String getHost()
Returns the hostname associated with the ServiceLog. Returns null if the ServiceLog is not writing to a socket.

 o getPort
 public int getPort()
Returns the port number associated with the ServiceLog. Returns -1 if the ServiceLog is not writing to a socket.

 o update
 public void update(Observable o,
                    Object obj)
Routine called when properties are updated by the Observable object.

 o close
 public void close()
Close the service log. Further writes will throw IOExceptions.

 o configureLog
 protected void configureLog(boolean update) throws IOException

All Packages  Class Hierarchy  This Package  Previous  Next  Index