org.cesta.util.ant
Class TaskLogHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.cesta.util.ant.TaskLogHandler

public class TaskLogHandler
extends java.util.logging.Handler

Log handler, which forwards all log messages to task's default handler. This way we are able to use Java Logging API in tasks and still be able to deal with logging listeners via Ant.

Author:
Tobias Smolka

Constructor Summary
TaskLogHandler(org.apache.tools.ant.Task task)
          Default constructor.
 
Method Summary
 void close()
           
 void flush()
           
 org.apache.tools.ant.Task getTask()
           
 boolean isLoggable(java.util.logging.LogRecord record)
           
 void publish(java.util.logging.LogRecord record)
           
 void setTask(org.apache.tools.ant.Task task)
           
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskLogHandler

public TaskLogHandler(org.apache.tools.ant.Task task)
Default constructor.

Parameters:
task - Task which will handle the logging
Method Detail

publish

public void publish(java.util.logging.LogRecord record)
Specified by:
publish in class java.util.logging.Handler

flush

public void flush()
Specified by:
flush in class java.util.logging.Handler

close

public void close()
           throws java.lang.SecurityException
Specified by:
close in class java.util.logging.Handler
Throws:
java.lang.SecurityException

isLoggable

public boolean isLoggable(java.util.logging.LogRecord record)
Overrides:
isLoggable in class java.util.logging.Handler

getTask

public org.apache.tools.ant.Task getTask()
Returns:
the task

setTask

public void setTask(org.apache.tools.ant.Task task)
Parameters:
task - the task to set