ozone core API

org.ozoneDB.util
Class LogWriterLog4JImpl

java.lang.Object
  |
  +--org.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  java.util.Set logTargets
          A set of log target.
private static java.lang.String OZONE_BASE_PACKAGE
           
private  org.apache.log4j.Logger ozoneRoot
           
 
Fields inherited from interface org.ozoneDB.util.LogWriter
DEBUG, DEBUG1, DEBUG2, DEBUG3, ERROR, FATAL, INFO, WARN
 
Constructor Summary
LogWriterLog4JImpl()
           
 
Method Summary
private  void addLogTarget(int level)
           
 void addLogTarget(java.io.PrintWriter writer, int level, java.lang.String name)
           
 void addLogTarget(java.lang.String name, java.io.OutputStream out, int level)
           
private  void createLogger(org.apache.log4j.Category logger)
           
private  org.apache.log4j.PatternLayout getLayout()
          get Ozone pattern layout
 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)
           
 
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

ozoneRoot

private org.apache.log4j.Logger ozoneRoot

currentLogLevel

private int currentLogLevel
Current log level


logTargets

private java.util.Set logTargets
A set of log target. This is to avoid the duplicated addition of log target

Constructor Detail

LogWriterLog4JImpl

public LogWriterLog4JImpl()
Method Detail

getLayout

private org.apache.log4j.PatternLayout getLayout()
get Ozone pattern layout


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

addLogTarget

private void addLogTarget(int level)

addLogTarget

public void addLogTarget(java.lang.String name,
                         java.io.OutputStream out,
                         int level)
Specified by:
addLogTarget in interface LogWriter

addLogTarget

public void addLogTarget(java.io.PrintWriter writer,
                         int level,
                         java.lang.String name)
Specified by:
addLogTarget in interface LogWriter

createLogger

private void createLogger(org.apache.log4j.Category 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.