# FPSDK 5.15 - EventLogCategory\[ \] GetCategories()

**URL:** <https://tech-community.robotics.abb.com/t/fpsdk-5-15-eventlogcategory-getcategories/5432>\
**Category:** Developer Tools\
**Created:** [March 19, 2013, 4:54pm UTC](https://tech-community.robotics.abb.com/t/fpsdk-5-15-eventlogcategory-getcategories/5432 "2013-03-19T16:54:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ECapitanio](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@ECapitanio](https://tech-community.robotics.abb.com/u/ECapitanio)\
**Post date:** [March 19, 2013, 4:54pm UTC](https://tech-community.robotics.abb.com/t/fpsdk-5-15-eventlogcategory-getcategories/5432/1 "2013-03-19T16:54:05Z")

</div>

Hi,  
I need of automatically write all Event message about the controller where run my FP application on a .csv file.  
I using EventLog class and in particular this code to get message event from controller:

{  
this.cntrl = new Controller();

System.IO.StreamWriter fileSTRM = new System.IO.StreamWriter(cntrl.FileSystem.RemoteDirectory+“/cLog.csv”, false, System.Text.Encoding.Unicode);

fileSTRM.AutoFlush = true;

fileSTRM.WriteLine(WriteColumnHeader());

EventLogCategory eCategories = cntrl.EventLog.GetCategories();

foreach (EventLogCategory ev\_cat in eCategories)  
{  
foreach (EventLogMessage ms in ev\_cat.Messages)  
{  
fileSTRM.WriteLine(EventLogMessageToString(ms));  
}  
}

fileSTRM.Flush();  
fileSTRM.Close();  
fileSTRM = null;

return false;  
}

The problem is that the numers of messages gets from EventLog.GetCategories() is not the same as i get (and save) the message manually from event panel of FlexPendat or Robostudio Online.  
I have made many test on virtual controller and always the messages gets from Robostudio Online is much more that i get from EventLog.GetCategories(). Why this? maybe is a bug?  
There is some way to automatically get all event messages from controller and save it (reparsed) on a file by scheduling (for example every week)?

In attachment there is a example code project build with VS2005, the eventLog created from my app. and the .log saved from Robostudio Online of same virtual controller.

[webwiz/3572/WriteLogTest.zip](http://forums.robotstudio.com/webwiz/3572/WriteLogTest.zip)

regars  
Ecapitanio

---

<div class="post-metadata">

**Author:** ![ECapitanio](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@ECapitanio](https://tech-community.robotics.abb.com/u/ECapitanio)\
**Post date:** [May 8, 2013, 10:12am UTC](https://tech-community.robotics.abb.com/t/fpsdk-5-15-eventlogcategory-getcategories/5432/2 "2013-05-08T10:12:39Z")

</div>

UP

---

<div class="post-metadata">

**Author:** ![ECapitanio](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@ECapitanio](https://tech-community.robotics.abb.com/u/ECapitanio)\
**Post date:** [May 8, 2013, 10:12am UTC](https://tech-community.robotics.abb.com/t/fpsdk-5-15-eventlogcategory-getcategories/5432/3 "2013-05-08T10:12:39Z")

</div>

UP!
