com.norconex.jef.log
Class FileLogManager

java.lang.Object
  extended by com.norconex.jef.log.FileLogManager
All Implemented Interfaces:
ILogManager

public class FileLogManager
extends Object
implements ILogManager

Log manager using the file system to store its logs.

Author:
Pascal Essiembre

Constructor Summary
FileLogManager(String logdir)
          Constructor.
FileLogManager(String logdir, Layout layout)
          Creates a new FileLogManager, wrapping the given layout into a ThreadSafeLayout.
 
Method Summary
 void backup(String namespace, Date backupDate)
          Backups the log for the given name space, and time stamps it with the given date.
 Appender createAppender(String namespace)
          Creates a Log4J appender for the given name space.
 InputStream getLog(String namespace)
          Gets the log for the given namespace.
 InputStream getLog(String namespace, String jobId)
          Gets the log for the given namespace and job identifier.
 File getLogFile(String namespace)
          Gets the log file used by this log manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLogManager

public FileLogManager(String logdir)
Constructor.

Parameters:
logdir - base directory where the log should be stored

FileLogManager

public FileLogManager(String logdir,
                      Layout layout)
Creates a new FileLogManager, wrapping the given layout into a ThreadSafeLayout.

Parameters:
logdir - base directory where the log should be stored
layout - Log4J layout for rendering the logs
Method Detail

createAppender

public final Appender createAppender(String namespace)
                              throws IOException
Description copied from interface: ILogManager
Creates a Log4J appender for the given name space.

Specified by:
createAppender in interface ILogManager
Parameters:
namespace - namespace of the executing context
Returns:
an appender
Throws:
IOException - problem creating the appender

backup

public final void backup(String namespace,
                         Date backupDate)
                  throws IOException
Description copied from interface: ILogManager
Backups the log for the given name space, and time stamps it with the given date. A backed-up log can no longer be retrieved by the getLog(String) method.

Specified by:
backup in interface ILogManager
Parameters:
namespace - namespace of the executing context
backupDate - date of this backup
Throws:
IOException - problem creating backup

getLog

public final InputStream getLog(String namespace)
                         throws IOException
Description copied from interface: ILogManager
Gets the log for the given namespace.

Specified by:
getLog in interface ILogManager
Parameters:
namespace - namespace of the executing context
Returns:
the log
Throws:
IOException - problem getting log

getLog

public InputStream getLog(String namespace,
                          String jobId)
                   throws IOException
Description copied from interface: ILogManager
Gets the log for the given namespace and job identifier.

Specified by:
getLog in interface ILogManager
Parameters:
namespace - namespace of the executing context
jobId - job identifier
Returns:
the log
Throws:
IOException - problem getting log

getLogFile

public File getLogFile(String namespace)
Gets the log file used by this log manager.

Parameters:
namespace - log file namespace
Returns:
log file


Copyright © 2007-2013 Norconex Inc.. All Rights Reserved.