You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by dl...@WPI.EDU on 2004/06/23 18:38:59 UTC

Logging maven output

Hi everyone,

I’m looking to automate the build process for a project I’m working on.
I’ve decided to use maven because it seems like a nifty little tool and
I’m frankly a little sick of re-writing the same old ant build files.

I’ve hit a little snag though. Ideally, all of the build logic would live
inside my project’s maven.xml, but I can’t seem to figure out how to
enable logging. I know I could just pipe stdout to a file, but that seems
unclean to me somehow. I really want to do this from within maven, not
some shell script.

Looking in the FAQ, I saw a reference to enabling log4j but for the life
of me I can’t seem to be able to do this. I tried embedding a log4j
configuration script in a maven goal like so:

<project xmlns:maven="jelly:maven"
         xmlns:j="jelly:core"
         xmlns:u="jelly:util"
         xmlns:log4j="http://jakarta.apache.org/log4j/">

<goal name="configure-logging">
    <!-- Get the timestamp for the log file -->
    <tstamp>
        <format property="timestamp" pattern="yyyy.MM.dd-kk.mm.ss"/>
    </tstamp>

    <!-- Set up logging -->
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
        <log4j:appender name="appender"
class="org.apache.log4j.FileAppender">
            <log4j:param name="File"
                         value="${log.dir}/nightly-build-${timestamp}.log"/>
        </log4j:appender>

        <log4j:root>
            <log4j:priority value ="debug"/>
            <log4j:appender-ref ref="appender"/>
        </log4j:root>
    </log4j:configuration>
</goal>
...
</project>

But maven just gives me a "Tag library requested that is not present:
'http://Jakarta.apache.org/log4j/'" error.

If someone knows of a way to dump maven's output to a timestamp-ed logfile
without using shell scripts, could you please tell me?

Thanks,

Dave



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