public class FileLogManager extends Object implements ILogManager
Log manager using the file system to store its logs.
When no log directory is explicitly set, it defaults to:
<user.home>/Norconex/jef/workdir
<logManager class="com.norconex.jef4.log.FileLogManager"> <logDir>(directory where to store logs)</logDir> </logManager>
The following example indicates logs should be stored in this directory:
/tmp/jeflogs
<logManager class="com.norconex.jef4.log.FileLogManager"> <logDir>/tmp/jeflogs</logDir> </logManager>
Constructor and Description |
---|
FileLogManager()
Constructor using default log directory location.
|
FileLogManager(String logdir)
Creates a new
FileLogManager , wrapping the given
layout into a ThreadSafeLayout . |
Modifier and Type | Method and Description |
---|---|
void |
backup(String suiteId,
Date backupDate)
Backups the log for the given name space, and time stamps it with
the given date.
|
Appender |
createAppender(String suiteId)
Creates a Log4J appender for the given name space.
|
boolean |
equals(Object other) |
InputStream |
getLog(String suiteId)
Gets the log for the given namespace.
|
InputStream |
getLog(String suiteId,
String jobId)
Gets the log for the given namespace and job identifier.
|
String |
getLogDirectory() |
File |
getLogFile(String suiteId)
Gets the log file used by this log manager.
|
int |
hashCode() |
void |
loadFromXML(Reader in) |
void |
saveToXML(Writer out) |
void |
setLogDirectory(String logdir) |
String |
toString() |
public FileLogManager()
public FileLogManager(String logdir)
FileLogManager
, wrapping the given
layout into a ThreadSafeLayout
.logdir
- base directory where the log should be storedpublic String getLogDirectory()
public void setLogDirectory(String logdir)
public final Appender createAppender(String suiteId) throws IOException
ILogManager
createAppender
in interface ILogManager
suiteId
- namespace of the executing contextIOException
- problem creating the appenderpublic final void backup(String suiteId, Date backupDate) throws IOException
ILogManager
getLog(String)
method.backup
in interface ILogManager
suiteId
- namespace of the executing contextbackupDate
- date of this backupIOException
- problem creating backuppublic final InputStream getLog(String suiteId) throws IOException
ILogManager
getLog
in interface ILogManager
suiteId
- namespace of the executing contextIOException
- problem getting logpublic InputStream getLog(String suiteId, String jobId) throws IOException
ILogManager
getLog
in interface ILogManager
suiteId
- namespace of the executing contextjobId
- job identifierIOException
- problem getting logpublic File getLogFile(String suiteId)
suiteId
- log file suiteIdpublic void loadFromXML(Reader in) throws IOException
loadFromXML
in interface com.norconex.commons.lang.config.IXMLConfigurable
IOException
public void saveToXML(Writer out) throws IOException
saveToXML
in interface com.norconex.commons.lang.config.IXMLConfigurable
IOException
Copyright © 2007–2021 Norconex Inc.. All rights reserved.