Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven Logging Custom output to a file

 
bhuvan emmandi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
bhuvan emmandi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic