brett 2004/02/19 15:28:31
Modified: src/conf Tag: MAVEN-1_0-BRANCH log4j.properties
src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH
MavenUtils.java
src/java/org/apache/maven/cli Tag: MAVEN-1_0-BRANCH App.java
CLIManager.java
src/java/org/apache/maven/jelly/tags/maven Tag:
MAVEN-1_0-BRANCH ReactorTag.java
Log:
improve logging output
Revision Changes Path
No revision
No revision
1.16.4.1 +1 -1 maven/src/conf/log4j.properties
Index: log4j.properties
===================================================================
RCS file: /home/cvs/maven/src/conf/log4j.properties,v
retrieving revision 1.16
retrieving revision 1.16.4.1
diff -u -r1.16 -r1.16.4.1
--- log4j.properties 19 Aug 2003 04:19:01 -0000 1.16
+++ log4j.properties 19 Feb 2004 23:28:31 -0000 1.16.4.1
@@ -7,7 +7,7 @@
# ------------------------------------------------------------------------
# R O O T C A T E G O R Y
# ------------------------------------------------------------------------
-log4j.rootCategory = INFO, default
+log4j.rootCategory = ERROR, default
log4j.appender.default = org.apache.log4j.FileAppender
log4j.appender.default.file = maven.log
log4j.appender.default.layout = org.apache.log4j.PatternLayout
No revision
No revision
1.107.4.9 +5 -2 maven/src/java/org/apache/maven/MavenUtils.java
Index: MavenUtils.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/MavenUtils.java,v
retrieving revision 1.107.4.8
retrieving revision 1.107.4.9
diff -u -r1.107.4.8 -r1.107.4.9
--- MavenUtils.java 7 Feb 2004 21:47:10 -0000 1.107.4.8
+++ MavenUtils.java 19 Feb 2004 23:28:31 -0000 1.107.4.9
@@ -842,7 +842,10 @@
{
try
{
- return loadProperties( new FileInputStream (file) );
+ if ( file.exists() )
+ {
+ return loadProperties( new FileInputStream (file) );
+ }
}
catch ( Exception e )
{
No revision
No revision
1.37.4.10 +16 -1 maven/src/java/org/apache/maven/cli/App.java
Index: App.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/cli/App.java,v
retrieving revision 1.37.4.9
retrieving revision 1.37.4.10
diff -u -r1.37.4.9 -r1.37.4.10
--- App.java 29 Jan 2004 01:04:15 -0000 1.37.4.9
+++ App.java 19 Feb 2004 23:28:31 -0000 1.37.4.10
@@ -64,6 +64,8 @@
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.apache.maven.MavenSession;
import org.apache.maven.MavenUtils;
import org.apache.maven.NoGoalException;
@@ -184,6 +186,9 @@
/** Emacs output option. */
private static final String EMACS_OUTPUT = "E";
+ /** Quiet option. */
+ private static final String QUIET = "q";
+
/** Debug option. */
private static final String DEBUG = "X";
@@ -363,9 +368,19 @@
setRootContext( c );
getRootContext().setXMLOutput( output );
+ // This is just a start at this mode - there'll still be some output
+ if ( getCli().hasOption( QUIET ) )
+ {
+ // A little bit of log4j specifics needed here
+ Logger.getLogger( "org.apache.maven" ).setLevel( Level.ERROR );
+ }
+
+ // -X takes precedence over -q
if ( getCli().hasOption( DEBUG ) )
{
getRootContext().setDebugOn( Boolean.TRUE );
+ // A little bit of log4j specifics needed here
+ Logger.getLogger( "org.apache.maven" ).setLevel( Level.DEBUG );
}
else
{
1.12.4.3 +5 -0 maven/src/java/org/apache/maven/cli/CLIManager.java
Index: CLIManager.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/cli/CLIManager.java,v
retrieving revision 1.12.4.2
retrieving revision 1.12.4.3
diff -u -r1.12.4.2 -r1.12.4.3
--- CLIManager.java 26 Jan 2004 23:36:08 -0000 1.12.4.2
+++ CLIManager.java 19 Feb 2004 23:28:31 -0000 1.12.4.3
@@ -165,6 +165,11 @@
.create( 'v' ) );
options.addOption( OptionBuilder
+ .withLongOpt( "quiet" )
+ .withDescription( "Reduce execution output" )
+ .create( 'q' ) );
+
+ options.addOption( OptionBuilder
.withLongOpt( "debug" )
.withDescription( "Produce execution debug output" )
.create( 'X' ) );
No revision
No revision
1.36.4.7 +12 -9 maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java
Index: ReactorTag.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java,v
retrieving revision 1.36.4.6
retrieving revision 1.36.4.7
diff -u -r1.36.4.6 -r1.36.4.7
--- ReactorTag.java 29 Jan 2004 01:04:15 -0000 1.36.4.6
+++ ReactorTag.java 19 Feb 2004 23:28:31 -0000 1.36.4.7
@@ -59,6 +59,8 @@
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenUtils;
import org.apache.maven.project.Project;
@@ -86,6 +88,7 @@
public class ReactorTag
extends MavenTag
{
+ private static final Log log = LogFactory.getLog( ReactorTag.class );
/** The glob used to select projects within the base directory. */
private String glob;
@@ -166,7 +169,7 @@
*/
public void setGlob( String glob )
{
- System.out.println( "\nDEPRECATION WARNING: use the 'includes' attribute
instead of the 'glob' attribute.\n" );
+ log.warn( "\nDEPRECATION WARNING: use the 'includes' attribute instead of
the 'glob' attribute.\n" );
this.glob = glob;
}
@@ -263,7 +266,7 @@
throw new MissingAttributeException( "glob|includes" );
}
- System.out.println( "Starting the reactor..." );
+ log.info( "Starting the reactor..." );
List sortedProjects = null;
try
@@ -275,12 +278,12 @@
throw new JellyTagException( "Error getting projects", e );
}
- System.out.println( "Our processing order:" );
+ log.info( "Our processing order:" );
for ( Iterator i = sortedProjects.iterator(); i.hasNext();)
{
Project p = (Project) i.next();
- System.out.println( p.getName() );
+ log.info( p.getName() );
}
Runtime r = Runtime.getRuntime();
@@ -294,10 +297,10 @@
try
{
final long mb = 1024 * 1024;
- System.out.println( "+----------------------------------------" );
- System.out.println( "| " + getBanner() + " " + project.getName() );
- System.out.println( "| Memory: " + ((r.totalMemory() -
r.freeMemory()) / mb) + "M/" + (r.totalMemory() / mb) + "M");
- System.out.println( "+----------------------------------------" );
+ log.info( "+----------------------------------------" );
+ log.info( "| " + getBanner() + " " + project.getName() );
+ log.info( "| Memory: " + ((r.totalMemory() - r.freeMemory()) / mb)
+ "M/" + (r.totalMemory() / mb) + "M");
+ log.info( "+----------------------------------------" );
// We only try to attain goals if they have been set. The reactor
// might be in use to collect project information for the purpose
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]