You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gajo Csaba <cs...@cosylab.com> on 2010/08/31 16:51:21 UTC

How to set log level when testing a custom mojo?

I know that I can set the log level to DEBUG mode with the -X option, 
but then I get thousands of lines of useless output. Is there a way I 
can limit the output to only my class? Something like 
-Dlog.level.com.mycompany=DEBUG ?

I've also attempted using log4j but it seems there's no easy way to make 
log4j realize where the lo4j.properties file is, when testing a custom 
mojo.

Anyway, what is the best way to do this?

Thanks, Csaba



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to set log level when testing a custom mojo?

Posted by Wayne Fay <wa...@gmail.com>.
> I know that I can set the log level to DEBUG mode with the -X option, but
> then I get thousands of lines of useless output. Is there a way I can limit
> the output to only my class? Something like -Dlog.level.com.mycompany=DEBUG

Logging in custom mojos in Maven is a bit difficult in my experience.
No such "debug for my class only" option exists that I'm aware of. I
end up just using -X and then piping it to grep.

> I've also attempted using log4j but it seems there's no easy way to make
> log4j realize where the lo4j.properties file is, when testing a custom mojo.

You could just do a log4j initializer in the code directly, rather
than using a log4j.properties file. And maybe use a plugin parameter
in the pom to kick it off or not?

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org