ozone core API

org.ozoneDB.util
Class LogWriterLog4JImpl

java.lang.Object
  extended byorg.ozoneDB.util.LogWriterLog4JImpl
All Implemented Interfaces:
LogWriter

public class LogWriterLog4JImpl
extends java.lang.Object
implements LogWriter

Author:
David Li, Per Nyfelt

Field Summary
private  int currentLogLevel
          Current log level
private static java.lang.String OZONE_BASE_PACKAGE
           
static java.lang.String PATTERN_LAYOUT
           
 
Fields inherited from interface org.ozoneDB.util.LogWriter
DEBUG, DEBUG1, DEBUG2, DEBUG3, ERROR, FATAL, INFO, LOG_CONFIG_FILE_NAME, LOG_FILE, WARN
 
Constructor Summary
LogWriterLog4JImpl(java.io.File configDir, org.apache.log4j.Level level)
          A set of log target.
 
Method Summary
private  void createLogger(org.apache.log4j.Logger logger)
           
private  void createLoggingProps(java.io.File loggingPropsfile, java.io.File logFile, java.lang.String logLevel)
           
private  java.lang.String ensureFileFormat(java.lang.String path)
          ensure properties file format.
 boolean hasTarget(int level)
          This method allows to quickly find out if there is any log target that would receive entries of the specified level.
 void newEntry(java.lang.Object sender, java.lang.String msg, int level)
           
 void newEntry(java.lang.Object sender, java.lang.String msg, java.lang.Throwable e, int level)
           
static void printLogInfo(org.apache.log4j.Logger logger)
           
 void setUpLogging(java.io.File configDir, org.apache.log4j.Level level)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OZONE_BASE_PACKAGE

private static final java.lang.String OZONE_BASE_PACKAGE
See Also:
Constant Field Values

PATTERN_LAYOUT

public static final java.lang.String PATTERN_LAYOUT
See Also:
Constant Field Values

currentLogLevel

private int currentLogLevel
Current log level

Constructor Detail

LogWriterLog4JImpl

public LogWriterLog4JImpl(java.io.File configDir,
                          org.apache.log4j.Level level)
                   throws java.io.IOException
A set of log target. This is to avoid the duplicated addition of log target

Method Detail

setUpLogging

public void setUpLogging(java.io.File configDir,
                         org.apache.log4j.Level level)
                  throws java.io.IOException
Throws:
java.io.IOException

createLoggingProps

private void createLoggingProps(java.io.File loggingPropsfile,
                                java.io.File logFile,
                                java.lang.String logLevel)
                         throws java.io.IOException
Throws:
java.io.IOException

ensureFileFormat

private java.lang.String ensureFileFormat(java.lang.String path)
ensure properties file format. Windows single \ will not work so we need to change it. Front slashes works fine.


hasTarget

public boolean hasTarget(int level)
This method allows to quickly find out if there is any log target that would receive entries of the specified level.

Specified by:
hasTarget in interface LogWriter

createLogger

private void createLogger(org.apache.log4j.Logger logger)

newEntry

public void newEntry(java.lang.Object sender,
                     java.lang.String msg,
                     int level)
Specified by:
newEntry in interface LogWriter

newEntry

public void newEntry(java.lang.Object sender,
                     java.lang.String msg,
                     java.lang.Throwable e,
                     int level)
Specified by:
newEntry in interface LogWriter

printLogInfo

public static void printLogInfo(org.apache.log4j.Logger logger)

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.