org.kuali.maven.mojo
Class MavenLogger

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.kuali.maven.mojo.MavenLogger
All Implemented Interfaces:
org.apache.commons.logging.Log, org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class MavenLogger
extends org.apache.log4j.AppenderSkeleton
implements org.apache.commons.logging.Log

A utility class that sets up logging for maven plugins so that any logging calls issued via Jakarta's Commons Logging or Log4j get routed through the maven logging system. This allows mojo's to invoke logic from other libraries and get the logging statements issued by those libraries issued to maven's console output


Field Summary
private static org.apache.maven.plugin.logging.Log mavenLog
           
private static org.apache.maven.plugin.logging.Log systemStreamLog
           
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
MavenLogger()
           
MavenLogger(String name)
          Jakarta Commons Logging requires a constructor that takes a string
 
Method Summary
protected  void append(org.apache.log4j.spi.LoggingEvent event)
           
 void close()
           
 void debug(Object message)
           
 void debug(Object message, Throwable t)
           
static void endPluginLog(org.apache.maven.plugin.AbstractMojo mojo)
          End logging for this plugin
 void error(Object message)
           
 void error(Object message, Throwable t)
           
 void fatal(Object message)
           
 void fatal(Object message, Throwable t)
           
protected  String getString(Object message)
          Check for null then call toString on the object
protected  Throwable getThrowable(org.apache.log4j.spi.LoggingEvent event)
           
 void info(Object message)
           
 void info(Object message, Throwable t)
           
 boolean isDebugEnabled()
           
 boolean isErrorEnabled()
           
 boolean isFatalEnabled()
           
 boolean isInfoEnabled()
           
 boolean isTraceEnabled()
           
 boolean isWarnEnabled()
           
 boolean requiresLayout()
           
static void startPluginLog(org.apache.maven.plugin.AbstractMojo mojo)
          Start logging for this plugin
 void trace(Object message)
           
 void trace(Object message, Throwable t)
           
 void warn(Object message)
           
 void warn(Object message, Throwable t)
           
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemStreamLog

private static org.apache.maven.plugin.logging.Log systemStreamLog

mavenLog

private static org.apache.maven.plugin.logging.Log mavenLog
Constructor Detail

MavenLogger

public MavenLogger()

MavenLogger

public MavenLogger(String name)
Jakarta Commons Logging requires a constructor that takes a string

Method Detail

startPluginLog

public static void startPluginLog(org.apache.maven.plugin.AbstractMojo mojo)
Start logging for this plugin


endPluginLog

public static void endPluginLog(org.apache.maven.plugin.AbstractMojo mojo)
End logging for this plugin


getThrowable

protected Throwable getThrowable(org.apache.log4j.spi.LoggingEvent event)

append

protected void append(org.apache.log4j.spi.LoggingEvent event)
Specified by:
append in class org.apache.log4j.AppenderSkeleton

close

public void close()
Specified by:
close in interface org.apache.log4j.Appender

requiresLayout

public boolean requiresLayout()
Specified by:
requiresLayout in interface org.apache.log4j.Appender

isDebugEnabled

public boolean isDebugEnabled()
Specified by:
isDebugEnabled in interface org.apache.commons.logging.Log

isErrorEnabled

public boolean isErrorEnabled()
Specified by:
isErrorEnabled in interface org.apache.commons.logging.Log

isFatalEnabled

public boolean isFatalEnabled()
Specified by:
isFatalEnabled in interface org.apache.commons.logging.Log

isInfoEnabled

public boolean isInfoEnabled()
Specified by:
isInfoEnabled in interface org.apache.commons.logging.Log

isTraceEnabled

public boolean isTraceEnabled()
Specified by:
isTraceEnabled in interface org.apache.commons.logging.Log

isWarnEnabled

public boolean isWarnEnabled()
Specified by:
isWarnEnabled in interface org.apache.commons.logging.Log

trace

public void trace(Object message)
Specified by:
trace in interface org.apache.commons.logging.Log

trace

public void trace(Object message,
                  Throwable t)
Specified by:
trace in interface org.apache.commons.logging.Log

debug

public void debug(Object message)
Specified by:
debug in interface org.apache.commons.logging.Log

debug

public void debug(Object message,
                  Throwable t)
Specified by:
debug in interface org.apache.commons.logging.Log

info

public void info(Object message)
Specified by:
info in interface org.apache.commons.logging.Log

info

public void info(Object message,
                 Throwable t)
Specified by:
info in interface org.apache.commons.logging.Log

warn

public void warn(Object message)
Specified by:
warn in interface org.apache.commons.logging.Log

warn

public void warn(Object message,
                 Throwable t)
Specified by:
warn in interface org.apache.commons.logging.Log

error

public void error(Object message)
Specified by:
error in interface org.apache.commons.logging.Log

error

public void error(Object message,
                  Throwable t)
Specified by:
error in interface org.apache.commons.logging.Log

fatal

public void fatal(Object message)
Specified by:
fatal in interface org.apache.commons.logging.Log

fatal

public void fatal(Object message,
                  Throwable t)
Specified by:
fatal in interface org.apache.commons.logging.Log

getString

protected String getString(Object message)
Check for null then call toString on the object



Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.