[ 
http://jira.codehaus.org/browse/MNG-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=187095#action_187095
 ] 

Julien HENRY commented on MNG-519:
----------------------------------

I think I have a better workaround.

1) Edit 
$MAVEN_HOME/lib/maven-2.2.1-uber.jar!org/codehaus/plexus/plexus-bootstrap.xml
Replace:
{code}
<component>
  <role>org.codehaus.plexus.logging.LoggerManager</role>
  
<implementation>org.codehaus.plexus.logging.console.ConsoleLoggerManager</implementation>
  <lifecycle-handler>basic</lifecycle-handler>
  <configuration>
    <threshold>info</threshold>
  </configuration>
</component>
{code}
by
{code}
<component>
  <role>org.codehaus.plexus.logging.LoggerManager</role>
  <implementation>
    org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager
  </implementation>
</component>
{code}

2) Download and move into $MAVEN_HOME/lib:
plexus-slf4j-logging-1.1-alpha-1.jar
slf4j-api-1.5.8.jar
And also the slf4j implementation you want to use (in my case it is logback):
logback-core-0.9.15.jar
logback-classic-0.9.15.jar

3) To configure logback you can use a logback.xml file. The only trick is that 
Maven loader will only pick JAR file in /lib folder so you can simply create a 
new JAR containing only logback.xml

For example here is my logback.xml:
{code}
<?xml version="1.0" encoding="UTF-8" ?>
    <!-- Logback configuration file -->
<configuration>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
      <layout class="ch.qos.logback.classic.PatternLayout">
          <!--Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - 
%msg%n</Pattern-->
          <Pattern>%-5level %d{HH:mm:ss.SSS} %msg%n</Pattern>
      </layout>
    </appender>
  
    <root>
        <level value="INFO" />
        <appender-ref ref="STDOUT" />
    </root>
</configuration>
{code}

And finally:

{code}
>mvn clean
INFO  15:01:32.785 Scanning for projects...
INFO  15:01:32.972 Reactor build order:
...
...
INFO  15:01:34.082 
------------------------------------------------------------------------
INFO  15:01:34.082 BUILD SUCCESSFUL
INFO  15:01:34.082 
------------------------------------------------------------------------
INFO  15:01:34.097 Total time: 1 second
INFO  15:01:34.097 Finished at: Fri Aug 14 15:01:34 CEST 2009
INFO  15:01:34.160 Final Memory: 7M/13M
INFO  15:01:34.160 
------------------------------------------------------------------------
There was no such logger 
'org.apache.maven.artifact.metadata.ArtifactMetadataSource:maven' 18061339.
There was no such logger 'org.apache.maven.plugin.PluginMappingManager' 
18061339.
There was no such logger 'org.apache.maven.artifact.resolver.ArtifactResolver' 
18061339.
There was no such logger 
'org.apache.maven.artifact.transform.ArtifactTransformation:snapshot' 18061339.
There was no such logger 'org.apache.maven.profiles.MavenProfilesBuilder' 
18061339.
{code}

There are two issues with this solution:
1) The -X flag does nothing. You have to manually update logback.xml to change 
INFO to DEBUG.
2) I don't know why there is the lines:
{code}
There was no such logger 'org.apache.maven.profiles.MavenProfilesBuilder' 
18061339.
{code}
at the end...

Hope that help.

> Timestamps on messages
> ----------------------
>
>                 Key: MNG-519
>                 URL: http://jira.codehaus.org/browse/MNG-519
>             Project: Maven 2
>          Issue Type: Wish
>          Components: Logging, Plugins and Lifecycle
>            Reporter: Jeff Jensen
>            Priority: Minor
>             Fix For: 3.x
>
>
> With current and/or moving forward with M2, I would like an option for 
> timestamped messages.
> We have a somewhat long nightly process.  I regularly wish for timestamps on 
> the log messages from the Maven build.  The two primary reasons for this are 
> duration calculation - how long did something take, and an occasional 
> correlation with an outside event.

-- 
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

        

Reply via email to