Author: vsiveton
Date: Mon Jan 14 20:17:35 2008
New Revision: 612012
URL: http://svn.apache.org/viewvc?rev=612012&view=rev
Log:
MNG-3273: Point out known pitfalls when developing plugins
Submitted by: Benjamin Bentmann
Reviewed by: Vincent Siveton
o applied
Modified:
maven/components/branches/maven-2.0.x/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java
Modified:
maven/components/branches/maven-2.0.x/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java
URL:
http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java?rev=612012&r1=612011&r2=612012&view=diff
==============================================================================
---
maven/components/branches/maven-2.0.x/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java
(original)
+++
maven/components/branches/maven-2.0.x/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java
Mon Jan 14 20:17:35 2008
@@ -159,8 +159,15 @@
}
/**
- * By default, return a <code>SystemStreamLog</code> logger.
- *
+ * Returns the logger that has been injected into this mojo. If no logger
has been setup yet, a <code>SystemStreamLog</code>
+ * logger will be created and returned.
+ * <br/><br/>
+ * <strong>Note:</strong>
+ * The logger returned by this method must not be cached in an instance
field during the construction of the mojo.
+ * This would cause the mojo to use a wrongly configured default logger
when being run by Maven. The proper logger
+ * gets injected by the Plexus container <em>after</em> the mojo has been
constructed. Therefore, simply call this
+ * method directly whenever you need the logger, it is fast enough and
needs no caching.
+ *
* @see org.apache.maven.plugin.Mojo#getLog()
*/
public Log getLog()