[ http://jira.codehaus.org/browse/MNG-2351?page=comments#action_66852 ]
Jerome Lacoste commented on MNG-2351:
-------------------------------------
* I also tried using setThreshold(Maven.ROLE, "default", 0) instead, but that
doesn't work better. The first version (without "default") manages to get my
test line
loggerManager.getLoggerForComponent( Maven.ROLE ).debug( "XXX logging level
" + request.getLoggingLevel());
printed, but nothing else. I guess another logger is used...
* I also wondered why the DefaultMaven class referes to the Mojo.ROLE,
Logger logger = loggerManager.getLoggerForComponent( Mojo.ROLE );
But trying to change that didn't affect anything.
* the only way I was able to achieve some kinds of results was by changing the
MavenCli class:
mavenEmbedder.setClassWorld( classWorld );
// added
mavenEmbedder.setLogger( new MavenEmbedderConsoleLogger() );
// end of added
mavenEmbedder.start();
there by specifying the threshold of the MavenEmbedderConsoleLogger, I manage
to get DEBUG messages, but they are prefixed by:
[ maven embedder INFO]
------------------------------------------------------------------------
[ maven embedder INFO] Total time: 3 seconds
[ maven embedder INFO] Finished at: Wed Jun 07 22:10:10 CEST 2006
[ maven embedder INFO] Final Memory: 2M/5M
[ maven embedder INFO]
------------------------------------------------------------------------
:(
* I suspect that the logger threshold must be set before starting the plexus
embedder, but I don't see any way of programatically achieving this result.
Note: in MavenEmbedder.start(), the following debug prints out *null* for the
logger field:
embedder = new Embedder();
System.err.println("XXX logger " + logger);
if ( logger != null )
{
embedder.setLoggerManager( new MavenEmbedderLoggerManager( new
PlexusLoggerAdapter( logger ) ) );
}
Not sure if that helps...
* relevant IRC exchange
(22:09:01) lacoste1: jdcasey: if I do setThreshold(Maven.ROLE, DEBUG) then I
see that the logger works with debug() later on, but as no other DEBUG message
is printed, I guess that a different logger is used from within the
application. I think that the logger threshold has to be initialized before the
embedder is started, and that means changing the MavenCli. Will try that...
(22:09:21) jdcasey: yup, I think you're right
(22:09:36) jdcasey: actually, before the Plexus embedder is started...
(22:09:50) jdcasey: if the MavenEmbedder exists outside of the plexus embedder,
it should be in the maven embedder
(22:09:53) jdcasey: not the CLI
(22:09:59) jdcasey: that way, it's reusable for embedded apps
> mvn -X doesn't enable debugging
> -------------------------------
>
> Key: MNG-2351
> URL: http://jira.codehaus.org/browse/MNG-2351
> Project: Maven 2
> Type: Bug
> Components: Embedding
> Versions: 2.1
> Reporter: Jerome Lacoste
>
>
> mvn -X doesn't enable debugging
> If I add the following code to DefaultMaven.execute(...)
> public void execute( MavenExecutionRequest request )
> throws MavenExecutionException
> [...]
>
> loggerManager.setThreshold( request.getLoggingLevel() );
> // ADDED
> loggerManager.getLoggerForComponent( Maven.ROLE ).info( "XXX logging
> level " + request.getLoggingLevel());
> loggerManager.getLoggerForComponent( Maven.ROLE ).debug( "XXX logging
> level " + request.getLoggingLevel());
> System.err.println("XXX logging level " + request.getLoggingLevel());
> System.err.println("XXX show errors " + request.isShowErrors());
> System.err.println("XXX logger threshold " +
> loggerManager.getLoggerForComponent( Maven.ROLE ).getThreshold());
> // end of ADDED
> I get:
> [INFO] XXX logging level 0
> XXX logging level 0
> XXX show errors true
> XXX logger threshold 1
> Looks like something is wrong with regard to thresholds in the Maven.ROLE
> component.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira