Author: vsiveton
Date: Sat Feb  2 14:29:15 2008
New Revision: 617913

URL: http://svn.apache.org/viewvc?rev=617913&view=rev
Log:
o improved logging

Modified:
    
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
    
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=617913&r1=617912&r2=617913&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
 Sat Feb  2 14:29:15 2008
@@ -1171,20 +1171,29 @@
         }
         catch ( IOException e )
         {
-            getLog().warn( "Unable to find the javadoc version: " + 
e.getMessage() );
-            getLog().warn( "Using the Java version instead of, i.e. " + 
SystemUtils.JAVA_VERSION_FLOAT );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( "Unable to find the javadoc version: " + 
e.getMessage() );
+                getLog().warn( "Using the Java version instead of, i.e. " + 
SystemUtils.JAVA_VERSION_FLOAT );
+            }
             jVersion = SystemUtils.JAVA_VERSION_FLOAT;
         }
         catch ( CommandLineException e )
         {
-            getLog().warn( "Unable to find the javadoc version: " + 
e.getMessage() );
-            getLog().warn( "Using the Java the version instead of, i.e. " + 
SystemUtils.JAVA_VERSION_FLOAT );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( "Unable to find the javadoc version: " + 
e.getMessage() );
+                getLog().warn( "Using the Java the version instead of, i.e. " 
+ SystemUtils.JAVA_VERSION_FLOAT );
+            }
             jVersion = SystemUtils.JAVA_VERSION_FLOAT;
         }
         catch ( IllegalArgumentException e )
         {
-            getLog().warn( "Unable to find the javadoc version: " + 
e.getMessage() );
-            getLog().warn( "Using the Java the version instead of, i.e. " + 
SystemUtils.JAVA_VERSION_FLOAT );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( "Unable to find the javadoc version: " + 
e.getMessage() );
+                getLog().warn( "Using the Java the version instead of, i.e. " 
+ SystemUtils.JAVA_VERSION_FLOAT );
+            }
             jVersion = SystemUtils.JAVA_VERSION_FLOAT;
         }
 
@@ -1201,7 +1210,10 @@
 
             if ( fJavadocVersion != jVersion )
             {
-                getLog().warn( "Are you sure about the <javadocVersion/> 
parameter? It seems to be " + jVersion );
+                if ( getLog().isWarnEnabled() )
+                {
+                    getLog().warn( "Are you sure about the <javadocVersion/> 
parameter? It seems to be " + jVersion );
+                }
             }
         }
         else
@@ -1301,7 +1313,10 @@
 
         if ( old && isJavaDocVersionAtLeast( SINCE_JAVADOC_1_4 ) )
         {
-            getLog().warn( "Javadoc 1.4+ doesn't support the -1.1 switch 
anymore. Ignore this option." );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( "Javadoc 1.4+ doesn't support the -1.1 switch 
anymore. Ignore this option." );
+            }
         }
         else
         {
@@ -1358,7 +1373,10 @@
                     if ( groups[i] == null || StringUtils.isEmpty( 
groups[i].getTitle() )
                         || StringUtils.isEmpty( groups[i].getPackages() ) )
                     {
-                        getLog().warn( "A group option is empty. Ignore this 
option." );
+                        if ( getLog().isWarnEnabled() )
+                        {
+                            getLog().warn( "A group option is empty. Ignore 
this option." );
+                        }
                     }
                     else
                     {
@@ -1415,7 +1433,10 @@
                 {
                     if ( ( taglets[i] == null ) || ( StringUtils.isEmpty( 
taglets[i].getTagletClass() ) ) )
                     {
-                        getLog().warn( "A taglet option is empty. Ignore this 
option." );
+                        if ( getLog().isWarnEnabled() )
+                        {
+                            getLog().warn( "A taglet option is empty. Ignore 
this option." );
+                        }
                     }
                     else
                     {
@@ -1432,7 +1453,10 @@
                 {
                     if ( StringUtils.isEmpty( tags[i].getName() ) )
                     {
-                        getLog().warn( "A tag name is empty. Ignore this 
option." );
+                        if ( getLog().isWarnEnabled() )
+                        {
+                            getLog().warn( "A tag name is empty. Ignore this 
option." );
+                        }
                     }
                     else
                     {
@@ -1499,7 +1523,10 @@
         // Execute command line
         // 
----------------------------------------------------------------------
 
-        getLog().debug( Commandline.toString( cmd.getCommandline() 
).replaceAll( "'", "" ) ); // no quoted arguments
+        if ( getLog().isDebugEnabled() )
+        {
+            getLog().debug( Commandline.toString( cmd.getCommandline() 
).replaceAll( "'", "" ) ); // no quoted arguments
+        }
 
         if ( debug )
         {
@@ -1516,7 +1543,10 @@
             }
             catch ( IOException e )
             {
-                getLog().warn( "Unable to write '" + commandLineFile.getName() 
+ "' debug script file", e );
+                if ( getLog().isWarnEnabled() )
+                {
+                    getLog().warn( "Unable to write '" + 
commandLineFile.getName() + "' debug script file", e );
+                }
             }
         }
 
@@ -1547,14 +1577,17 @@
 
         if ( StringUtils.isNotEmpty( err.getOutput() ) )
         {
-            getLog().info( "Javadoc Warnings" );
-
-            StringTokenizer token = new StringTokenizer( err.getOutput(), "\n" 
);
-            while ( token.hasMoreTokens() )
+            if ( getLog().isWarnEnabled() )
             {
-                String current = token.nextToken().trim();
+                getLog().warn( "Javadoc Warnings" );
+
+                StringTokenizer token = new StringTokenizer( err.getOutput(), 
"\n" );
+                while ( token.hasMoreTokens() )
+                {
+                    String current = token.nextToken().trim();
 
-                getLog().warn( current );
+                    getLog().warn( current );
+                }
             }
         }
     }
@@ -1793,6 +1826,24 @@
                                 .resolveTransitively( dependencyArtifacts, 
subProject.getArtifact(), subProject
                                     .getRemoteArtifactRepositories(), 
localRepository, artifactMetadataSource );
                             populateCompileArtifactMap( compileArtifactMap, 
JavadocUtil.getCompileArtifacts( result.getArtifacts() ) );
+
+                            if ( getLog().isDebugEnabled() )
+                            {
+                                StringBuffer sb = new StringBuffer();
+
+                                sb.append( "Compiled artifacts for " );
+                                sb.append( subProject.getGroupId() ).append( 
":" );
+                                sb.append( subProject.getArtifactId() 
).append( ":" );
+                                sb.append( subProject.getVersion() ).append( 
'\n' );
+                                for ( Iterator it = 
compileArtifactMap.keySet().iterator(); it.hasNext(); )
+                                {
+                                    String key = it.next().toString();
+
+                                    sb.append( compileArtifactMap.get( key ) 
).append( '\n' );
+                                }
+
+                                getLog().debug( sb.toString() );
+                            }
                         }
                     }
                 }
@@ -1939,7 +1990,10 @@
         }
         else
         {
-            getLog().error( "Unrecognized access level to show '" + show + "'. 
Defaulting to protected." );
+            if ( getLog().isErrorEnabled() )
+            {
+                getLog().error( "Unrecognized access level to show '" + show + 
"'. Defaulting to protected." );
+            }
             accessLevel = "-protected";
         }
 
@@ -1988,9 +2042,12 @@
 
         if ( StringUtils.isEmpty( path.toString() ) )
         {
-            getLog().warn(
-                           "No docletpath option was found. Please review 
<docletpath/> or <docletArtifact/>"
-                               + " or <doclets/>." );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn(
+                               "No docletpath option was found. Please review 
<docletpath/> or <docletArtifact/>"
+                                   + " or <doclets/>." );
+            }
         }
 
         return path.toString();
@@ -2127,7 +2184,10 @@
             }
             catch ( IllegalArgumentException e )
             {
-                getLog().error( "Malformed memory pattern for '" + arg + 
memory + "'. Ignore this option." );
+                if ( getLog().isErrorEnabled() )
+                {
+                    getLog().error( "Malformed memory pattern for '" + arg + 
memory + "'. Ignore this option." );
+                }
             }
         }
     }
@@ -2142,12 +2202,20 @@
         // backward compatible
         if ( StringUtils.isNotEmpty( proxyHost ) )
         {
-            getLog().warn( "The Javadoc plugin parameter 'proxyHost' is 
deprecated since 2.4. Please configure an active proxy in your settings.xml." );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( "The Javadoc plugin parameter 'proxyHost' is 
deprecated since 2.4. " +
+                        "Please configure an active proxy in your 
settings.xml." );
+            }
             cmd.createArgument().setValue( "-J-DproxyHost=" + proxyHost );
 
             if ( proxyPort > 0 )
             {
-                getLog().warn( "The Javadoc plugin parameter 'proxyPort' is 
deprecated since 2.4. Please configure an active proxy in your settings.xml." );
+                if ( getLog().isWarnEnabled() )
+                {
+                    getLog().warn( "The Javadoc plugin parameter 'proxyPort' 
is deprecated since 2.4. " +
+                        "Please configure an active proxy in your 
settings.xml." );
+                }
                 cmd.createArgument().setValue( "-J-DproxyPort=" + proxyPort );
             }
         }
@@ -2318,7 +2386,11 @@
         }
         else
         {
-            getLog().warn( value + " option is not supported on Java version < 
" + requiredJavaVersion + ". Ignore this option." );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( value + " option is not supported on Java 
version < " + requiredJavaVersion
+                               + ". Ignore this option." );
+            }
         }
     }
 
@@ -2361,7 +2433,11 @@
         }
         else
         {
-            getLog().warn( key + " option is not supported on Java version < " 
+ requiredJavaVersion + ". Ignore this option." );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( key + " option is not supported on Java version 
< " + requiredJavaVersion
+                               + ". Ignore this option." );
+            }
         }
     }
 
@@ -2463,7 +2539,10 @@
         }
         else
         {
-            getLog().warn( key + " option is not supported on Java version < " 
+ requiredJavaVersion );
+            if ( getLog().isWarnEnabled() )
+            {
+                getLog().warn( key + " option is not supported on Java version 
< " + requiredJavaVersion );
+            }
         }
     }
 
@@ -2557,11 +2636,17 @@
                 }
                 catch ( MalformedURLException e )
                 {
-                    getLog().error( "Malformed link: " + link + 
"/package-list. Ignored it." );
+                    if ( getLog().isErrorEnabled() )
+                    {
+                        getLog().error( "Malformed link: " + link + 
"/package-list. Ignored it." );
+                    }
                 }
                 catch ( IOException e )
                 {
-                    getLog().error( "Error fetching link: " + link + 
"/package-list. Ignored it." );
+                    if ( getLog().isErrorEnabled() )
+                    {
+                        getLog().error( "Error fetching link: " + link + 
"/package-list. Ignored it." );
+                    }
                 }
             }
         }

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java?rev=617913&r1=617912&r2=617913&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java
 (original)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java
 Sat Feb  2 14:29:15 2008
@@ -101,7 +101,10 @@
         ArtifactHandler artifactHandler = 
project.getArtifact().getArtifactHandler();
         if ( !"java".equals( artifactHandler.getLanguage() ) )
         {
-            getLog().info( "Not executing Javadoc as the project is not a Java 
classpath-capable package" );
+            if ( getLog().isInfoEnabled() )
+            {
+                getLog().info( "Not executing Javadoc as the project is not a 
Java classpath-capable package" );
+            }
         }
         else
         {
@@ -115,8 +118,10 @@
 
                     if ( !attach )
                     {
-                        getLog().info( "NOT adding javadoc to attached 
artifacts list." );
-
+                        if ( getLog().isInfoEnabled() )
+                        {
+                            getLog().info( "NOT adding javadoc to attached 
artifacts list." );
+                        }
                     }
                     else
                     {


Reply via email to