|
SAP NetWeaver 7.20 (SP01) Composition Environment | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sap.tc.logging.ExceptionHandling
com.sap.tc.logging.Log
com.sap.tc.logging.StreamLog
com.sap.tc.logging.FileLog
public class FileLog
Writes log records to files.
| Field Summary | |
|---|---|
static int |
DEF_LIMIT
|
static int |
MODE_FILE_SET
|
static int |
MODE_MAX
|
static int |
MODE_MIN
|
static int |
MODE_SINGLE_FILE
|
static int |
NO_CNT
|
static int |
NO_LIMIT
|
| 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 |
FileLog()
|
|
FileLog(String pattern)
Configures this file log for writing to a single file. |
|
FileLog(String pattern,
boolean append)
Same as FileLog(java.lang.String)
but configures for writing with a custom appending logic. |
|
FileLog(String pattern,
Formatter formatter)
Same as FileLog(java.lang.String)
but configures for writing with a custom formatter. |
|
FileLog(String pattern,
Formatter formatter,
boolean append)
Same as FileLog(java.lang.String)
but configures for writing with a custom formatter and appending logic. |
|
FileLog(String pattern,
int limit,
int cnt)
Configures this file log for writing to a rotating set of numbered files. |
|
FileLog(String pattern,
int limit,
int cnt,
Formatter formatter)
Same as FileLog(java.lang.String,
int,
int)
but configures for writing with a custom formatter. |
|
FileLog(String pattern,
String enc)
Same as FileLog(java.lang.String)
but configures for writing with a custom character encoding. |
|
FileLog(String pattern,
String enc,
boolean append)
Same as FileLog(java.lang.String)
but configures for writing with a custom character encoding and appending
logic. |
|
FileLog(String pattern,
String enc,
Formatter formatter)
Same as FileLog(java.lang.String)
but configures for writing with a custom formatter and character encoding. |
|
FileLog(String pattern,
String enc,
Formatter formatter,
boolean append)
Same as FileLog(java.lang.String)
but configures for writing with a custom character encoding, formatter and
appending logic. |
|
FileLog(String pattern,
String enc,
int limit,
int cnt)
Same as FileLog(java.lang.String,
int,
int)
but configures for writing with a custom character encoding. |
|
FileLog(String pattern,
String enc,
int limit,
int cnt,
Formatter formatter)
Same as FileLog(java.lang.String,
int,
int)
but configures for writing with a custom formatter and character encoding. |
| Method Summary | |
|---|---|
List |
calculateFileNames()
|
static Collection |
calculateFileNames(String filePattern,
int fileCount)
|
protected Object |
clone()
|
boolean |
equals(Object object)
|
protected boolean |
equalsPattern(String pattern,
boolean onlyNewFormat)
|
protected String |
expandPattern(boolean onlyNewFormat)
|
protected String |
expandPattern(int fileIndex,
boolean onlyNewFormat)
|
protected String |
expandPattern(String filePattern,
int fileCount,
boolean isRotate,
boolean onlyNewFormat)
|
String |
findBeginningOfFileSet()
Returns the pathname string of the file from the file set, where the first (oldest) message was written. |
String |
findEndOfFileSet()
Returns the pathname string of the file from the file set, where the last (newest) message was written. |
int |
getCnt()
Gets the max count number of rotating fileset |
String |
getFileCurrentlyBeingWritten()
Deprecated. Same as getFileName() |
long |
getFileLength()
Returns the length of the file(s). |
String |
getFileName()
Deprecated. A current return value is equal to the java.io.File.getPath() (path name) but from the name of the method java.io.File.getName() (file name) is expected. Please use the FileLog.getPath() for getting a path name value, and the java.io.File.getName() for getting a file name value. |
String |
getFileNamePattern()
|
String |
getFilePathPattern()
|
int |
getIndex()
Gets the current file index in the rotating file set |
int |
getLimit()
Gets the limit file size used for sequencing on the rotating output file |
String |
getLogId()
Deprecated. Same as getPattern() |
int |
getMode()
Get current working mode of the FileLog return 0 == FileLog.MODE_FILE_SET 1 == FileLog.MODE_SINGLE_FILE |
String |
getParent()
Returns the pathname string of this FileLog object's pattern's parent, or null if the pattern does not expand to a pathname
that has a parent directory. |
File |
getParentFile()
Deprecated. Use new java.io.File(FileLog.getParent()) |
String |
getPath()
Returns the pathname string of the current file this FileLog object represent. |
String |
getPattern()
Gets the file name pattern of this file log. |
boolean |
isAppend()
Checks whether this file log writes messages to the end of the specified file rather than the beginning. |
protected void |
resetInt()
Reset all current FileLog settings and starts from beginning Current file |
protected void |
setAppend(boolean append)
|
protected void |
setCnt(int value)
|
void |
setFormatter(Formatter formatter)
Sets the formatter that dictates the format of log records in this log. |
protected void |
setFormatterInt(Formatter formatter)
|
protected void |
setIndex(int value)
|
protected void |
setLimit(int value)
|
void |
setMode(int mode)
Set current working mode of the FileLog mode 0 == FileLog.MODE_FILE_SET 1 == FileLog.MODE_SINGLE_FILE |
protected void |
setPattern(String pattern)
|
void |
setRotation(int limit,
int cnt)
Set the max count number of rotating fileset and set the limit file size used for sequencing on the rotating output file This may change behaviour of the curent rotating fileset in a way: - Setting an incompatible value to the count or the limit will kill the rotating file set. |
protected void |
writeInt(String s)
Writes a log message string to this log. |
protected void |
writeLogFooter()
Writes a log footer to this log. |
protected void |
writeLogHeader()
Writes a log header to this log. |
| Methods inherited from class com.sap.tc.logging.StreamLog |
|---|
closeInt, flushInt, getEncoding, getOutputStream, openInt, setEncoding |
| 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, resetLoggedCount, setAutoFlush, setDescription, setEffectiveSeverity, setFooter, setHeader, setHeaderWritten, setLocalLogOwner, setLogName, setLogTypeAccessibility, setName, setSize, setStatus, setSuppressing, setVerInUse, size, status, write, writeInt |
| Methods inherited from class com.sap.tc.logging.ExceptionHandling |
|---|
getException, getExceptions, handleException, handleException, resetException, throwException |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sap.tc.logging.interfaces.ILog |
|---|
addFilter, beLogged, close, flush, getEffectiveSeverity, getEncoding, getFilters, getFooter, getFormatter, getHeader, getLogTypeAccessibility, getNumberOfLogRecordsWritten, isAutoFlush, isClosed, isOpened, open, removeFilter, removeFilters, setAutoFlush, setEffectiveSeverity, setEncoding, setLogTypeAccessibility, status |
| Methods inherited from interface com.sap.tc.logging.interfaces.IObjectInfo |
|---|
getDescription, getName, getVerInUse |
| Field Detail |
|---|
public static final int DEF_LIMIT
public static final int NO_LIMIT
public static final int NO_CNT
public static final int MODE_MIN
public static final int MODE_SINGLE_FILE
public static final int MODE_FILE_SET
public static final int MODE_MAX
| Constructor Detail |
|---|
public FileLog(String pattern)
/ the local file name separator%h the home directory%t the system temporary directory%u a unique number to make the file name unique%% the percentage sign
pattern - File name patternFileLog(java.lang.String,
int,
int)
public FileLog(String pattern,
boolean append)
FileLog(java.lang.String)
but configures for writing with a custom appending logic. If the specified
file exists but the second argument is false file content will
be deleted before writing.
pattern - File name patternappend - If false file content will be deleted before
writing
public FileLog(String pattern,
Formatter formatter)
FileLog(java.lang.String)
but configures for writing with a custom formatter.
pattern - File name patternformatter - FormatterFileLog(java.lang.String,
int,
int,
Formatter)
public FileLog(String pattern,
Formatter formatter,
boolean append)
FileLog(java.lang.String)
but configures for writing with a custom formatter and appending logic. If
the specified file exists but the third argument is false file
content will be deleted before writing.
pattern - File name patternformatter - Formatterappend - If false file content will be deleted before
writing
public FileLog(String pattern,
String enc)
throws UnsupportedEncodingException
FileLog(java.lang.String)
but configures for writing with a custom character encoding.
pattern - File name patternenc - Name of character encoding
UnsupportedEncodingException - Character encoding not supportedFileLog(java.lang.String,
java.lang.String,
int,
int)
public FileLog(String pattern,
String enc,
boolean append)
throws UnsupportedEncodingException
FileLog(java.lang.String)
but configures for writing with a custom character encoding and appending
logic. If the specified file exists but the third argument is
false file content will be deleted before writing.
pattern - File name patternenc - Name of character encodingappend - If false file content will be deleted before
writing
UnsupportedEncodingException - Character encoding not supported
public FileLog(String pattern,
String enc,
Formatter formatter)
throws UnsupportedEncodingException
FileLog(java.lang.String)
but configures for writing with a custom formatter and character encoding.
pattern - File name patternenc - Name of character encodingformatter - Formatter
UnsupportedEncodingException - Character encoding not supportedFileLog(java.lang.String,
java.lang.String,
int,
int)
public FileLog(String pattern,
String enc,
Formatter formatter,
boolean append)
throws UnsupportedEncodingException
FileLog(java.lang.String)
but configures for writing with a custom character encoding, formatter and
appending logic. If the specified file exists but the fourth argument is
false file content will be deleted before writing.
pattern - File name patternenc - Name of character encodingformatter - Formatterappend - If false file content will be deleted before
writing
UnsupportedEncodingException - Character encoding not supported
public FileLog(String pattern,
int limit,
int cnt)
%g can be used in the pattern where the number of
the file is supposed to go.
pattern - File name patternlimit - Limit of file sizes in byte or DEF_LIMITcnt - Maximum number of files in set or NO_CNT
IllegalArgumentException - Pattern or one, but not both, of
limit and cnt
unspecifiedFileLog(java.lang.String)
public FileLog(String pattern,
int limit,
int cnt,
Formatter formatter)
FileLog(java.lang.String,
int,
int)
but configures for writing with a custom formatter.
pattern - File name patternlimit - Limit of file sizes in byte or DEF_LIMITcnt - Maximum number of files in set or NO_CNTformatter - Formatter
IllegalArgumentException - Pattern or one, but not both, of
limit and cnt
unspecifiedFileLog(java.lang.String, Formatter)
public FileLog(String pattern,
String enc,
int limit,
int cnt)
throws UnsupportedEncodingException
FileLog(java.lang.String,
int,
int)
but configures for writing with a custom character encoding.
pattern - File name patternenc - Name of character encodinglimit - Limit of file sizes in byte or DEF_LIMITcnt - Maximum number of files in set or NO_CNT
UnsupportedEncodingException - Character encoding not supported
IllegalArgumentException - Pattern or one, but not both, of
limit and
cnt unspecifiedFileLog(java.lang.String,
java.lang.String,
int,
int)
public FileLog(String pattern,
String enc,
int limit,
int cnt,
Formatter formatter)
throws UnsupportedEncodingException
FileLog(java.lang.String,
int,
int)
but configures for writing with a custom formatter and character encoding.
pattern - File name patternenc - Name of character encodinglimit - Limit of file sizes in byte or DEF_LIMITcnt - Maximum number of files in set or NO_CNTformatter - Formatter
UnsupportedEncodingException - Character encoding not supported
IllegalArgumentException - Pattern or one, but not both, of
limit and
cnt unspecifiedFileLog(java.lang.String,
java.lang.String,
int,
int)protected FileLog()
| Method Detail |
|---|
public int getMode()
public void setMode(int mode)
public void setFormatter(Formatter formatter)
setFormatter in interface ILogsetFormatter in class LogLog.getFormatter()public List calculateFileNames()
public static Collection calculateFileNames(String filePattern,
int fileCount)
public long getFileLength()
getFileLength in interface IFileLogIOException - if an I/O error occurs.public String getPath()
getPath in interface IFileLogpublic String getParent()
null if the pattern does not expand to a pathname
that has a parent directory.
getParent in interface IFileLogpublic String getPattern()
getPattern in interface IFileLogpublic String getFilePathPattern()
public String getFileNamePattern()
public int getLimit()
getLimit in interface IFileLogpublic int getCnt()
getCnt in interface IFileLogpublic int getIndex()
public void setRotation(int limit,
int cnt)
count <= 0 or/and limit <= 0
- Set FileLog mode to MODE_FILE_SET
- All changes are active immediately on a newly created file!
public boolean isAppend()
isAppend in interface IFileLogtrue if and only if this file log writes messages to
the end of the specified file rather than the beginningpublic boolean equals(Object object)
equals in class Objectpublic String findBeginningOfFileSet()
public String findEndOfFileSet()
protected void setFormatterInt(Formatter formatter)
protected void resetInt()
resetInt in class Log
protected Object clone()
throws CloneNotSupportedException
clone in class StreamLogCloneNotSupportedExceptionprotected void writeLogHeader()
Log
writeLogHeader in class Logprotected void writeLogFooter()
Log
writeLogFooter in class Log
protected void writeInt(String s)
throws Exception
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.
writeInt in class StreamLogIOException - Exception from writing messages to the destination
Exception
protected boolean equalsPattern(String pattern,
boolean onlyNewFormat)
protected String expandPattern(boolean onlyNewFormat)
protected String expandPattern(int fileIndex,
boolean onlyNewFormat)
protected void setIndex(int value)
protected void setCnt(int value)
protected void setLimit(int value)
protected void setPattern(String pattern)
protected void setAppend(boolean append)
protected String expandPattern(String filePattern,
int fileCount,
boolean isRotate,
boolean onlyNewFormat)
public String getFileName()
getFileName in interface IFileLogpublic String getFileCurrentlyBeingWritten()
getFileName()
public File getParentFile()
new java.io.File(FileLog.getParent())
public String getLogId()
getPattern()
| Access Rights |
|---|
| 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
|
|
SAP NetWeaver 7.20 (SP01) Composition Environment | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||