Hi, Dennis,

I'd suggest the following approach:

- Write a small stub that replaces Logger.getLogger(), so that a small
facade is returned, which behaves like JUL,
   but uses the Maven logger internally.
- Use the shade plugin to ensure that Logger.getLogger is redirected
to your stub.

That way, you don't need modifications in Cobertura upstream, but are
still controlling what's being logged and how,

Jochen


On Tue, Nov 11, 2014 at 8:48 AM, Dennis Lundberg <denn...@apache.org> wrote:
> Hi,
>
> I'm working on the Cobertura Maven Plugin over at Mojo, and have run
> into a problem that I cannot solve.
>
> This plugin wraps an external tool, Cobertura, which logs stuff either
> by System.out.println() or by using Java Util Logging (JUL). The
> printing to standard out/err is not a problem and the output ends up
> where expected. The problem is with JUL. Here's an output example when
> using Cobertura's own command line inteface:
>
> Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
> 2014-nov-11 08:18:03
> net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler
> loadCoverageData
> INFO: Cobertura: Loaded information on 5 classes.
> Report time: 231ms
>
> The first line is using stdout and the last 2 lines are a log message using 
> JUL.
>
> Now here's what the output form the plugin looks like, after being
> handled by CommandLineUtils.executeCommanLine() from plexus-utils:
>
> [INFO] Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
> [ERROR] 2014-nov-11 08:24:29
> net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler
> loadCoverageData
> INFO: Cobertura: Loaded information on 5 classes.
>
> As you can see the first line is OK, but the second line is not.
> Somewhere the logging output from JUL is interpreted as being an error
> on the Maven side of things.
>
> Is there any way to tell plexus-utils to treat JUL as being on INFO
> level, or better yet to wrap JUL inside a Mojo logger?
>
>
> --
> Dennis Lundberg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>



-- 
Our time is just a point along a line that runs forever with no end.
(Al Stewart, Lord Grenville)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to