📅  最后修改于: 2020-12-26 13:39:49             🧑  作者: Mango
它是一项功能,使我们可以在执行期间监视Ant的进度。 Ant使用两个概念进行监视:侦听器和记录器,两者均由Ant本身提供。请参阅下面所有受支持的侦听器。
记录器用于扩展侦听器功能。它具有各种功能,请参见下文。
Apache Ant侦听器和记录器接口也可以用UML表示。请参阅下面的UML图。
它是BuildListener和BuildLogger接口的UML图。
DataType | Parameter | Description |
---|---|---|
org.apache.tools.ant.DefaultLogger | It is default logger and be overridden with the -logger command-line switch. | BuildLogger |
org.apache.tools.ant.NoBannerLogger | It is used to omit output of empty target output. | BuildLogger |
org.apache.tools.ant.listener.MailLogger | It extends DefaultLogger and generate the same output and send an email too. | BuildLogger |
org.apache.tools.ant.listener.AnsiColorLogger | It is used to provide colors to the build output. | BuildLogger |
org.apache.tools.ant.listener.Log4jListener | It is used to pass events to Apache Log4j logging. | BuildListener |
org.apache.tools.ant.XmlLogger | It writes the build information to an XML file. | BuildLogger |
org.apache.tools.ant.TimestampedLogger | It is used to print the time that a build finished. | BuildLogger |
org.apache.tools.ant.listener.BigProjectLogger | It is used to print the project name every target has. | BuildLogger |
org.apache.tools.ant.listener.SimpleBigProjectLogger | It prints the project name for subprojects only. | BuildLogger |
org.apache.tools.ant.listener.ProfileLogger | It is a default logger with start times, end times and durations added for each task and target. | BuildLogger |
可以将任何数量的构建侦听器附加到项目。通过指定侦听器类,我们可以在从命令行运行ant时使用侦听器。
可以使用以下命令运行DefaultLogger,请参阅此处传递的DefaultLogger类。
$ ant -logger org.apache.tools.ant.DefaultLogger
MailLogger使用DefaultLogger捕获所有输出日志,并通过唯一的电子邮件列表发送成功和失败消息。
Property | Description | Required |
---|---|---|
MailLogger.mailhost | Mail server to use | No; default localhost |
MailLogger.port | SMTP Port for the Mail server | No; default 25 |
MailLogger.user | user name for SMTP auth | Yes, if SMTP auth is required on your SMTP server |
MailLogger.password | password for SMTP auth | Yes, if SMTP auth is required on your SMTP server |
MailLogger.ssl | on or true if SSL is needed This feature requires JavaMail | No |
MailLogger.from | Mail from address | Yes, if mail needs to be sent |
MailLogger.replyto | Mail replyto address(es), comma-separated | No |
MailLogger.success.to | Address(es) to send success messages to, comma-separated | Yes, if success mail is to be sent |
MailLogger.success.cc | Address(es) to send success messages to carbon copy (cc), comma-separated | No |
MailLogger.success.bcc | Address(es) to send success messages to blind carbon copy (bcc), comma-separated | No |
命令行中的MailLogger
例如
ant -logger org.apache.tools.ant.listener.MailLogger