Redirect Report output from a proxied task to a file.
Task package: | org.schmant.task.base |
Java package: | org.schmant.task.proxy |
Category: | Meta tasks |
Since: | 0.6 |
EntityFS-aware? | Yes* |
Implements: | ActionTaskFactory GeneratorTaskFactory ProcessTaskFactory |
Produces: | The generated object of the proxied task, if that task generates one. |
Restriction: | Several parallel execution threads should not use this to log to the same file. That will not work. |
Description:
Redirect report (logged) output from a proxied task to a file.
This task factory implements ProcessTaskFactory so that it can be used by a RecursiveActionTF or a RecursiveProcessTF.
Required properties
Properties
alsoAppendToPreviousReport | top |
Should output also be reported to the previous report? The previous report is the report that was substituted by this task, often the standard output report.
- Setter method:
setAlsoAppendToPreviousReport(boolean b)
parameters:b
– Also log to the previous report?- Default value:
true
appendToExistingLogFile | top |
If the log file already exists, should it be appended to rather than overwritten?
- Setter method:
setAppendToExistingLogFile(boolean b)
parameters:b
– Append?- Default value:
true
level | top |
Set the minimum log level for report entries written to the file.
- Setter method:
setLevel(Level l)
parameters:l
– The log level.- Default value:
- Use the log level from the previous report.
logFile (required) | top |
The log file to log report output to. If the file does not exist, it is created. Its parent directory must already exist, otherwise the task exits with an error.
- Setter method:
setLogFile(Object o)
parameters:
logFooter | top |
The message that is logged to info
level
after the task has been successfully run.
- Setter method:
setLogFooter(String s)
parameters:s
– The footer message.- Default value:
- Empty (no footer message is logged.)
- See also:
- logHeader
logHeader | top |
The message that is logged to info
level
before the task is run.
- Setter method:
setLogHeader(String s)
parameters:s
– The header message.- Default value:
- A task class specific message.
- See also:
- logFooter
reportLevel | top |
This property is used to change the Report level for all task created by this task factory. The report level is changed for the thread running the task when the it is run, and is restored to its previous level when the it is done.
- Setter method:
setReportLevel(Level l)
Set the report levelparameters:l
– The new report level.
reportLineFormatter | top |
The ReportLineFormatter to use for formatting report output.
- Setter method:
setReportLineFormatter(ReportLineFormatter f)
parameters:f
– The formatter.- Default value:
- A SimpleReportLineFormatter instance.
taskFactory (required) | top |
Task factory for creating proxied tasks.
- Setter method:
setTaskFactory(TaskFactory<?, ?> f)
parameters:f
– A task factory.
traceLogging | top |
If trace logging is enabled for a task, it reports its configuration before it is run.
Trace logging may also be enabled globally for all tasks by calling TraceMode.setTraceMode(boolean).
- Setter method:
setTraceLogging(boolean b)
Enable or disable trace logging.parameters:b
– Enable trace logging?
Examples
Example 1
Redirect the report to a file when running a Java compilation task. Files are
compiled from the src
directory and put in the bin
directory. Output is logged to the javac.log
file in the
logDir
directory.
JavaScript
* An EntityFS-aware task is implemented using EntityFS. This means that it uses the filter settings of DirectoryView:s and also that it often can work with other file system implementations than File-based, such as the RAM file system.