Class SysLogger

java.lang.Object
  extended by SysLogger

public class SysLogger
extends java.lang.Object

The class SysLogger provides methods for logging messages of differing priorities to the syslog.


Field Summary
private  java.lang.String identification
           
private  java.net.InetAddress in
           
private static java.lang.String ipAddress
           
private  boolean logOpened
           
private  java.lang.String logOptions
           
private  java.lang.String message
           
private  java.lang.String priority
           
private  boolean sendOkay
           
private  java.lang.String severity
           
 
Constructor Summary
SysLogger()
          Contructor
 
Method Summary
 void closeLog()
          Stop the logging process
 boolean isOpen()
          Checks if the Log is open
 void openLog()
          Starts the logging process
 void openLog(java.lang.String ident, java.lang.String logopt)
          Starts the logging process
private  void sendMessage(java.lang.String identity, java.lang.String logSev, java.lang.String logMsg)
          Sends message to the specified syslogd server
private  java.lang.String setLocalHostAddress()
          Sets LocalHost Address
 void setSysLogger()
          Sets the IP address of the syslogd server
 void setSysLogger(java.lang.String ip)
          Sets the IP address of the syslogd server
 java.lang.String showSysLogger()
          Shows the IP address of the syslogd server
 void sysLog(java.lang.String sev, java.lang.String msg)
          Log the message provided to the specific syslogd server after opening the log at the specified severity level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ipAddress

private static java.lang.String ipAddress

identification

private java.lang.String identification

logOptions

private java.lang.String logOptions

severity

private java.lang.String severity

priority

private java.lang.String priority

message

private java.lang.String message

logOpened

private boolean logOpened

sendOkay

private boolean sendOkay

in

private java.net.InetAddress in
Constructor Detail

SysLogger

public SysLogger()
Contructor

Parameters:
none -
Method Detail

setLocalHostAddress

private java.lang.String setLocalHostAddress()
Sets LocalHost Address

Parameters:
none -
Returns:
IP address as String

isOpen

public boolean isOpen()
Checks if the Log is open

Parameters:
none -
Returns:
true or false

setSysLogger

public void setSysLogger()
Sets the IP address of the syslogd server

If the client doesn't specify the syslogd's IP address, localhost is assumed to be the syslogd server.

Parameters:
none -

setSysLogger

public void setSysLogger(java.lang.String ip)
Sets the IP address of the syslogd server

If the client doesn't specify the syslogd's IP address, localhost is assumed to be the syslogd server.

Parameters:
ip - IP address of the syslogd server

showSysLogger

public java.lang.String showSysLogger()
Shows the IP address of the syslogd server

If the client doesn't specify the syslogd's IP address, by calling setSysLogger(), localhost's IP address is returned

Parameters:
none -
Returns:
syslogd server's IP address.

openLog

public void openLog()
Starts the logging process

Just by calling openLog() with no arguments, starts logging without identification prefix to the messages. IP address of client machine is logged wherever supported. "Java App" is prefixed to all the messages logged.

Parameters:
none -

openLog

public void openLog(java.lang.String ident,
                    java.lang.String logopt)
Starts the logging process

Logging process starts by calling openLog() and String ident is used to prefix all the logged messages.

Parameters:
ident - This is used as prefix to all the messages sent to the syslogd
logopt - Specifies the logging options to be used.

closeLog

public void closeLog()
Stop the logging process

No more logging will occur after log has been closed.

Parameters:
none - return none

sysLog

public void sysLog(java.lang.String sev,
                   java.lang.String msg)
            throws java.io.IOException,
                   UnOpenedLogException
Log the message provided to the specific syslogd server after opening the log at the specified severity level.

This method checks to see if the log has been previously opened, and then sets the messages severity level as specified.

Parameters:
sev - Defines the severity of the message
msg - Message to be logged
Throws:
UnOpenedLogException - If log has not been previously openend.
java.io.IOException

sendMessage

private void sendMessage(java.lang.String identity,
                         java.lang.String logSev,
                         java.lang.String logMsg)
                  throws UnOpenedLogException
Sends message to the specified syslogd server

Not directky called by the application developer

Throws:
UnOpenedLogException