public abstract class FileLogItem extends LogItem
LogItems, FileLogItem
supports two more attributes: file spec and parent directory. File spec is
the name (with or without path) of the file. It can be specified in absolute
or relative form. When a relative path is specified, it is used together with
parent directory to determine the full path of the file. If file spec is
absolute, the parent directory is ignored.| Constructor and Description |
|---|
FileLogItem(long mode,
java.lang.String parent,
java.lang.String file)
Creates a disabled
FileLogItem with file name as the name,
and sets its log level to LOGLEVEL_INFO. |
FileLogItem(java.lang.String name,
long mode,
boolean enabled,
java.lang.String parent,
java.lang.String file)
Creates a
FileLogItem and sets its log level to
LOGLEVEL_INFO. |
FileLogItem(java.lang.String name,
long mode,
int level,
boolean enabled,
java.lang.String parent,
java.lang.String file)
Creates a
FileLogItem. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
fileExists()
Tests if the file represented by this log item exists.
|
java.lang.String |
getAbsolutePath()
Returns the full path to the file represented by this log item.
|
java.lang.String |
getFileSpec()
Returns the file spec for this log.
|
java.lang.String |
getParentDir()
Returns the parent directory for this log.
|
boolean |
isFileSpecAbsolute()
Tests if the file spec of this log is absolute or relative.
|
void |
setParentDir(java.lang.String dir)
Sets the parent directory for this log.
|
close, dateTime, isClosed, logMessagepublic FileLogItem(java.lang.String name,
long mode,
int level,
boolean enabled,
java.lang.String parent,
java.lang.String file)
FileLogItem.
name - the name of this log item. If null, it is
set to the file name.mode - the type of this log (LOGMODE constant
defined by AbstractLogFacility).level - the log level for this log.enabled - true to enable this log; false
to disable.parent - the parent directory of this log.file - the file spec of this log.public FileLogItem(java.lang.String name,
long mode,
boolean enabled,
java.lang.String parent,
java.lang.String file)
FileLogItem and sets its log level to
LOGLEVEL_INFO.
name - the name of this log item. If null, it is
set to the file name.mode - the type of this log (LOGMODE constant
defined by AbstractLogFacility).enabled - true to enable this log; false
to disable.parent - the parent directory of this log.file - the file spec of this log.public FileLogItem(long mode,
java.lang.String parent,
java.lang.String file)
FileLogItem with file name as the name,
and sets its log level to LOGLEVEL_INFO.
mode - the type of this log (LOGMODE constant
defined by AbstractLogFacility).parent - the parent directory of this log.file - the file spec of this log.public java.lang.String getFileSpec()
public boolean isFileSpecAbsolute()
true if the file spec is absolute;
false if it is relative.public java.lang.String getParentDir()
public void setParentDir(java.lang.String dir)
dir - the new parent directory.public java.lang.String getAbsolutePath()
public boolean fileExists()
true if getAbsolutePath points to an
existing file; false otherwise.Copyright © SAS Institute. All Rights Reserved.