com.sap.tc.logging

Class StreamLog

java.lang.Object
  extended by com.sap.tc.logging.ExceptionHandling
      extended by com.sap.tc.logging.Log
          extended by com.sap.tc.logging.StreamLog
All Implemented Interfaces:
ILog, IObjectInfo, Cloneable
Direct Known Subclasses:
ConsoleLog, FileLog

public class StreamLog
extends Log

Writes log records to output streams.


Field Summary
 
Fields inherited from class com.sap.tc.logging.Log
LOG_ACCESSABILITY_TYPE_LOCAL_LOG, LOG_ACCESSABILITY_TYPE_NORMAL_LOG, LOG_ACCESSABILITY_TYPE_PRIVATE_LOG, STATUS_CLOSED, STATUS_INVALID, STATUS_OPENED
 
Fields inherited from class com.sap.tc.logging.ExceptionHandling
EX_NO_FILTER_EMSG, EX_NO_FORMATTER_EMSG, EX_NO_INSTANCE_EMSG
 
Constructor Summary
protected StreamLog()
           
protected StreamLog(Formatter formatter)
           
  StreamLog(OutputStream stream)
          Configures this stream log for writing to an output stream.
  StreamLog(OutputStream stream, Formatter formatter)
          Same as StreamLog(java.io.OutputStream) but configures for writing with a custom formatter.
  StreamLog(OutputStream stream, String enc)
          Configures this stream log for writing to an output stream with a custom character encoding.
  StreamLog(OutputStream stream, String enc, Formatter formatter)
          Same as StreamLog(java.io.OutputStream, java.lang.String) but configures for writing with a custom formatter and character encoding.
protected StreamLog(String enc, Formatter formatter)
           
 
Method Summary
protected  Object clone()
           
protected  void closeInt()
          Closes output of this log object.
protected  void flushInt()
          Flushes buffered records in this log object.
 String getEncoding()
          Gets the canonical name of the character encoding that is used for this log.
protected  OutputStream getOutputStream()
           
protected  void openInt()
          Open output of this log object.
 void setEncoding(String enc)
          Sets the named character encoding to be used for this log.
protected  void writeInt(String s)
           Writes a log message string to this log.
 
Methods inherited from class com.sap.tc.logging.Log
addFilter, addOwner, beGroup, beLogged, close, finalize, flush, getDescription, getEffectiveSeverity, getFilters, getFooter, getFormatter, getHeader, getLocalLogOwner, getLoggedCount, getLogName, getLogTypeAccessibility, getName, getNumberOfLogRecordsWritten, getOwners, getRecord, getVerInUse, isAutoFlush, isClosed, isFiltersAgreeing, isHeaderWritten, isOpened, isSuppressing, open, removeFilter, removeFilters, removeOwner, reset, resetInt, resetLoggedCount, setAutoFlush, setDescription, setEffectiveSeverity, setFooter, setFormatter, setHeader, setHeaderWritten, setLocalLogOwner, setLogName, setLogTypeAccessibility, setName, setSize, setStatus, setSuppressing, setVerInUse, size, status, write, writeInt, writeLogFooter, writeLogHeader
 
Methods inherited from class com.sap.tc.logging.ExceptionHandling
getException, getExceptions, handleException, handleException, resetException, throwException
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamLog

protected StreamLog()

StreamLog

protected StreamLog(Formatter formatter)

StreamLog

protected StreamLog(String enc,
                    Formatter formatter)

StreamLog

public StreamLog(OutputStream stream)
Configures this stream log for writing to an output stream.

Parameters:
stream - Output stream
See Also:
StreamLog(java.io.OutputStream, java.lang.String)

StreamLog

public StreamLog(OutputStream stream,
                 Formatter formatter)
Same as StreamLog(java.io.OutputStream) but configures for writing with a custom formatter.

Parameters:
stream - Output stream
formatter - Formatter
See Also:
StreamLog(java.io.OutputStream, java.lang.String, Formatter)

StreamLog

public StreamLog(OutputStream stream,
                 String enc)
          throws UnsupportedEncodingException
Configures this stream log for writing to an output stream with a custom character encoding.

Parameters:
stream - Output stream
enc - Name of character encoding
Throws:
UnsupportedEncodingException
See Also:
StreamLog(java.io.OutputStream)

StreamLog

public StreamLog(OutputStream stream,
                 String enc,
                 Formatter formatter)
          throws UnsupportedEncodingException
Same as StreamLog(java.io.OutputStream, java.lang.String) but configures for writing with a custom formatter and character encoding.

Parameters:
stream - Output stream
enc - Name of character encoding
formatter - Formatter
Throws:
UnsupportedEncodingException - Character encoding not supported
See Also:
StreamLog(java.io.OutputStream, Formatter)
Method Detail

getEncoding

public String getEncoding()
Gets the canonical name of the character encoding that is used for this log. If no character encoding is set the default character encoding of the platform is used.

Specified by:
getEncoding in interface ILog
Specified by:
getEncoding in class Log
Returns:
Name of character encoding
See Also:
setEncoding(java.lang.String)

setEncoding

public void setEncoding(String enc)
Sets the named character encoding to be used for this log. If no character encoding is set the default character encoding is used. Note: To use new encoding value, the Log must be first closed using the #Log.close() method, then opened with #Log.open() method.

Specified by:
setEncoding in interface ILog
Specified by:
setEncoding in class Log
Parameters:
enc - Name of character encoding
See Also:
getEncoding()

clone

protected Object clone()
                throws CloneNotSupportedException
Overrides:
clone in class Log
Throws:
CloneNotSupportedException

getOutputStream

protected OutputStream getOutputStream()

writeInt

protected void writeInt(String s)
                 throws Exception
Description copied from class: Log

Writes a log message string to this log. This method is meant as the standard way of implementing the fashion in which a log message is written to its destination. Note that this method is called inside a synchronized statement that locks this log, in order to avoid deadlocks.

If you need access to the log record to be written you should override Log.writeInt(java.lang.String). Note that, nevertheless, even in this case it is usually necessary to reimplement this method.

Overrides:
writeInt in class Log
Throws:
IOException - Exception from writing messages to the destination
Exception

flushInt

protected void flushInt()
                 throws IOException
Description copied from class: Log
Flushes buffered records in this log object. This method is meant for overriding the fashion in which buffered log records are flushed. You should not call this method from the outside because you would ignore common actions that have to take place for each flush.

Overrides:
flushInt in class Log
Throws:
IOException - Exception from flushing records to the destination

openInt

protected void openInt()
                throws IOException
Description copied from class: Log
Open output of this log object. This method is meant for overriding the fashion in which the log is open. You should not call this method from the outside because you would ignore common actions that have to take place for each open, for example writing the header defined by the formatter.

Overrides:
openInt in class Log
Throws:
IOException - Exception from opening the destination

closeInt

protected void closeInt()
                 throws IOException
Description copied from class: Log
Closes output of this log object. This method is meant for overriding the fashion in which the log is closed. You should not call this method from the outside because you would ignore common actions that have to take place for each close, for example writing the footer defined by the formatter.

Overrides:
closeInt in class Log
Throws:
IOException - Exception from closing the destination
Access Rights

This class can be accessed from:


SC DC
[sap.com] FRAMEWORK [sap.com] tc/ddic/ddicruntime
[sap.com] ENGINEAPI [sap.com] tc/logging
[sap.com] ENGFACADE [sap.com] tc/bl/logging/api
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.lib
[sap.com] BRMS-FACADE [sap.com] tc/brms/facade


Copyright 2010 SAP AG Complete Copyright Notice