org.apache.tools.ant.listener

Class CommonsLoggingListener

public class CommonsLoggingListener extends Object implements BuildListener, BuildLogger

Jakarta Commons Logging listener. Note: do not use the SimpleLog as your logger implementation as it causes an infinite loop since it writes to System.err, which Ant traps and reroutes to the logger/listener layer. The following names are used for the log: org.apache.tools.ant.Project.PROJECT_NAME - for project events org.apache.tools.ant.Target.TARGET_NAME - for target events TASK_CLASS_NAME.TARGET_NAME - for events in individual targets. In all target and project names we replace "." and " " with "-". TODO: we should use the advanced context logging features (and expose them in c-l first :-) TODO: this is _very_ inefficient. Switching the out and tracking the logs can be optimized a lot - but may require few more changes to the core.

Since: Ant 1.5

Field Summary
static StringPROJECT_LOG
name of the category under which project events are logged
static StringTARGET_LOG
name of the category under which target events are logged
Constructor Summary
CommonsLoggingListener()
Construct the listener and make sure that a LogFactory can be obtained.
Method Summary
voidbuildFinished(BuildEvent event)
{@inheritDoc }.
voidbuildStarted(BuildEvent event)
{@inheritDoc }.
voidmessageLogged(BuildEvent event)
{@inheritDoc }.
voidsetEmacsMode(boolean emacsMode)
Set emacs mode.
voidsetErrorPrintStream(PrintStream err)
Set the error print stream.
voidsetMessageOutputLevel(int level)
Set the the output level.
voidsetOutputPrintStream(PrintStream output)
Set the output print stream.
voidtargetFinished(BuildEvent event)
{@inheritDoc }.
voidtargetStarted(BuildEvent event)
{@inheritDoc }.
voidtaskFinished(BuildEvent event)
{@inheritDoc }.
voidtaskStarted(BuildEvent event)
{@inheritDoc }.

Field Detail

PROJECT_LOG

public static final String PROJECT_LOG
name of the category under which project events are logged

TARGET_LOG

public static final String TARGET_LOG
name of the category under which target events are logged

Constructor Detail

CommonsLoggingListener

public CommonsLoggingListener()
Construct the listener and make sure that a LogFactory can be obtained.

Method Detail

buildFinished

public void buildFinished(BuildEvent event)
{@inheritDoc }.

buildStarted

public void buildStarted(BuildEvent event)
{@inheritDoc }.

messageLogged

public void messageLogged(BuildEvent event)
{@inheritDoc }.

setEmacsMode

public void setEmacsMode(boolean emacsMode)
Set emacs mode. This is ignored.

Parameters: emacsMode ignored

setErrorPrintStream

public void setErrorPrintStream(PrintStream err)
Set the error print stream.

Parameters: err the error stream

setMessageOutputLevel

public void setMessageOutputLevel(int level)
Set the the output level. This is not used, the logger config is used instead.

Parameters: level ignored

setOutputPrintStream

public void setOutputPrintStream(PrintStream output)
Set the output print stream.

Parameters: output the output stream

targetFinished

public void targetFinished(BuildEvent event)
{@inheritDoc }.

targetStarted

public void targetStarted(BuildEvent event)
{@inheritDoc }.

taskFinished

public void taskFinished(BuildEvent event)
{@inheritDoc }.

taskStarted

public void taskStarted(BuildEvent event)
{@inheritDoc }.