# Any ideas for filtering logs?

**URL:** https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656
**Category:** Discussion
**Created:** [November 14, 2007, 9:13am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656 "2007-11-14T09:13:29Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mikep](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/a4c791/32.png) [@mikep](https://www.finalbuilder.com/forums/u/mikep)
#### Post date: [November 14, 2007, 9:13am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/1 "2007-11-14T09:13:29Z")

</div>

Hi,

We use Visual Studio .NET for building.&nbsp; When a build fails, I'd like to email the build log (or a link to the html build log) to the development team.&nbsp; However, I'd like to filter out everything except the VS.NET part of the log (so users don't have to dig through all of the FB output).

Any suggestions on how to do this?

Thanks.

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 14, 2007, 11:33am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/2 "2007-11-14T11:33:24Z")

</div>

Hi Mike,   
  
Thanks for posting. There are a few ways you could do this. Here are three suggestions:   
  
1) The Export Log action has an "Export only Error Actions" option which will probably cut down the number of actions exported in the log.   
  
2) If it's just a single action, you can use the "Log Output to Variable" option to log to a variable, and then include that variable in the body of the email.   
  
3) If neither of these two are flexible enough, you can use XSLT to extract just the output from Visual Studio actions. Let me know if you'd like to see an example of this.   
  
Regards,   
  
Angus

---

<div class="post-metadata">

### Author: ![rwerning](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/65b543/32.png) [@rwerning](https://www.finalbuilder.com/forums/u/rwerning)
#### Post date: [November 15, 2007, 5:20am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/3 "2007-11-15T05:20:15Z")

</div>

Other option for you - I have a Ruby script that I use as the final step of our build proces to parse out&nbsp;lines containing keywords and save it to a seperate log file.&nbsp; After the parsing is done I have FB email the log to me.&nbsp;

I've been meaning to blog about it for some time, so if there is interest I can see about getting it to my website and posting the link here once I get done converting it to work with FB5 output.

- Rich Werning

---

<div class="post-metadata">

### Author: ![mikep](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/a4c791/32.png) [@mikep](https://www.finalbuilder.com/forums/u/mikep)
#### Post date: [November 15, 2007, 9:46am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/4 "2007-11-15T09:46:57Z")

</div>

All of these ideas sounds good. I will try the “Log Output to Variable” method and see how that works. If you happen to have an XSLT example handy, I would like to see it.   
  
 Thanks,   
 Mike

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 15, 2007, 11:17am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/5 "2007-11-15T11:17:14Z")

</div>

Hi Mike,   
  
 I did put together something similar a year or so ago, I’ll see if I can find it for you.   
  
 Regards,   
  
 Angus

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [November 16, 2007, 4:51am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/6 "2007-11-16T04:51:19Z")

</div>

IMHO, the “log output to variable” is very powerful. I only discovered it recently. But you can do great constructs like:   
  
  
 try   
[VS.net](http://VS.net) build whatever (log to X)   
[VS.net](http://VS.net) build whatever (log to X)   
[VS.net](http://VS.net) build whatever (log to X)   
 catch   
 email X to someone   
 end   
  
 So you end up with X containing only the output from the variable that failed. The possible pitfall though is that if the build fails in a surprising way you can end up with a misleading log message, so it might be best to clear X after each build step if it succeeds.   
  
 You could also send the buildlog.htm’s that [VS.net](http://VS.net) automatically produces…   
  
 Steve

---

<div class="post-metadata">

### Author: ![mikep](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/a4c791/32.png) [@mikep](https://www.finalbuilder.com/forums/u/mikep)
#### Post date: [November 16, 2007, 1:03am UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/7 "2007-11-16T01:03:11Z")

</div>

I did try using the “log output to variable” method and it worked well, gave me exactly what I wanted. One question – is the “content” of an action list variable cleared each time before it is written to, or is the content maintained for the duration of the action list? I found that in order to get the results I was looking for, I had to write to my log file after each time I did a “log output to variable”.

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 19, 2007, 12:05pm UTC](https://www.finalbuilder.com/forums/t/any-ideas-for-filtering-logs/656/8 "2007-11-19T12:05:11Z")

</div>

Hi Mike,   
  
 Each time you do a “log to variable” the contents of the variable will be overwritten.   
  
 If you need to append variable contents to each other, there is an Append Variable action. However, Steve’s suggestion (always logging to the same variable, so if there is an error you only have output from the one single action that failed) is probably worth considering as well.   
  
 Regards,   
  
 Angus
