railo.commons.io.log
Class LogResource

java.lang.Object
  extended by railo.commons.io.log.LogResource
All Implemented Interfaces:
Log
Direct Known Subclasses:
LogFile

public class LogResource
extends Object
implements Log

Simple Logger to log data to a file


Field Summary
static long MAX_FILE_SIZE
          maximum file size of for a log file
static int MAX_FILES
          maximum number of files (history of files)
 
Fields inherited from interface railo.commons.io.log.Log
LEVEL_DEBUG, LEVEL_ERROR, LEVEL_FATAL, LEVEL_INFO, LEVEL_WARN
 
Constructor Summary
LogResource(Resource res, int logLevel, String charset)
          Constructor of the Logger
LogResource(Resource res, long maxFileSize, int maxFiles, int logLevel, String charset)
          Constructor of the Logger
LogResource(Resource res, long maxFileSize, int logLevel, String charset)
          Constructor of the Logger
 
Method Summary
 void debug(String application, String message)
          log level debug
 void error(String application, String message)
          log level error
 void fatal(String application, String message)
          log level fatal
 int getLogLevel()
           
 int getMaxFiles()
           
 long getMaxFileSize()
           
 Resource getResource()
           
 void info(String application, String message)
          log level info
 void log(int level, String application, String message)
          log one line
 void setLogLevel(int level)
           
 String toString()
           
 void warn(String application, String message)
          log level warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_FILES

public static final int MAX_FILES
maximum number of files (history of files)

See Also:
Constant Field Values

MAX_FILE_SIZE

public static final long MAX_FILE_SIZE
maximum file size of for a log file

See Also:
Constant Field Values
Constructor Detail

LogResource

public LogResource(Resource res,
                   int logLevel,
                   String charset)
            throws IOException
Constructor of the Logger

Parameters:
res - resource to log to
logLevel -
Throws:
IOException

LogResource

public LogResource(Resource res,
                   long maxFileSize,
                   int logLevel,
                   String charset)
            throws IOException
Constructor of the Logger

Parameters:
res - resource to log to
maxFileSize - max file size if file is greater creates a backup file of the actuell file and creates a new one.
logLevel -
Throws:
IOException

LogResource

public LogResource(Resource res,
                   long maxFileSize,
                   int maxFiles,
                   int logLevel,
                   String charset)
            throws IOException
Constructor of the Logger

Parameters:
res - resource to log to
maxFileSize - max file size if file is greater creates a backup file of the actuell file and creates a new one.
maxFiles - max count of files
logLevel -
Throws:
IOException
Method Detail

log

public void log(int level,
                String application,
                String message)
Description copied from interface: Log
log one line

Specified by:
log in interface Log
Parameters:
level - level to log (Log.LEVEL_DEBUG, Log.LEVEL_WARN, Log.LEVEL_ERROR)
application - application name
message - message to log

info

public void info(String application,
                 String message)
Description copied from interface: Log
log level info

Specified by:
info in interface Log
Parameters:
application - application name
message - message to log

debug

public void debug(String application,
                  String message)
Description copied from interface: Log
log level debug

Specified by:
debug in interface Log
Parameters:
application - application name
message - message to log

warn

public void warn(String application,
                 String message)
Description copied from interface: Log
log level warn

Specified by:
warn in interface Log
Parameters:
application - application name
message - message to log

error

public void error(String application,
                  String message)
Description copied from interface: Log
log level error

Specified by:
error in interface Log
Parameters:
application - application name
message - message to log

fatal

public void fatal(String application,
                  String message)
Description copied from interface: Log
log level fatal

Specified by:
fatal in interface Log
Parameters:
application - application name
message - message to log

getResource

public Resource getResource()
Returns:
Returns the resource.

getLogLevel

public int getLogLevel()
Specified by:
getLogLevel in interface Log
Returns:
returns the log level of the log

setLogLevel

public void setLogLevel(int level)
Specified by:
setLogLevel in interface Log
Parameters:
level - sets the log level of the log

toString

public String toString()
Overrides:
toString in class Object

getMaxFileSize

public long getMaxFileSize()
Returns:
the maxFileSize

getMaxFiles

public int getMaxFiles()
Returns:
the maxFiles


Copyright © 2012 Railo