aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven Logging Custom output to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven Logging Custom output to a file" Watch "Maven Logging Custom output to a file" New topic
Author

Maven Logging Custom output to a file

bhuvan emmandi
Greenhorn

Joined: Mar 01, 2012
Posts: 3
Hi rancher,
I am a newbie here and to Maven. I am trying to figure how i can log execution details into a log file. Also, If I want to out some values like version, release number, execution status and details incase of failure. How can I do this? Any guidance will help.

I dont want to use mvn clean install > file.log

Is there a maven way of doing this.

Thanks in advance.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

Have you tried running "mvn -?" to see what all of the options are. Do that and take a look at the -l option, perhaps that will do what you want.

Other than that, the only options you have are levels of detail on the output, with the current set of output being one option, and the -X being the other. If you really want to get only those items mentioned, you will have to parse the log output.


JBoss In Action
bhuvan emmandi
Greenhorn

Joined: Mar 01, 2012
Posts: 3
HI Peter,
Thanks for the quick reply. As I told you, I am new to Maven, going through the documentation as well. I will try your suggestions and see if that helps.
bhuvan emmandi
Greenhorn

Joined: Mar 01, 2012
Posts: 3
Hi Peter,
This helps me to output the execution log but does not give me handle to echo my own message during execution. I want to echo some message like

"date projectxyz {status:true, msg:"success or fail message"}"

is this possible in maven?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

There is nothing like that built into Maven, but I did find a plugin that will do that:
http://code.google.com/p/maven-echo-plugin/

If you need anything more specific you might have to write your own plugin.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven Logging Custom output to a file