Logging All AMI Events

Nov 24, 2014 at 9:04 AM
Hey Ben Merrills a.k.a Skrusty,

Is there a way we can log all AMI events into a .txt file? For troubleshooting etc etc like log4net or any other open source.

Regards,
Abdullah
Nov 24, 2014 at 9:40 AM
Yeah, AsterNET (and this is legacy from Asterisk.NET) writes by default to Debug. You can hook into this and write it to a log file. Take a look in the discussions, someone else raised this and a code sample was provided to show how to write to a file. (Can't off the top of my head remember how)
Nov 24, 2014 at 10:33 AM
Okay, btw I messaged you, see your inbox.
Nov 24, 2014 at 11:05 AM
replied! :)
Nov 24, 2014 at 11:22 AM
Edited Nov 24, 2014 at 12:23 PM
searched through all the discussions unable to find, anyway I'll try to edit sources myself.
Nov 24, 2014 at 5:28 PM
I've not tried this myself yet, but you could turn on debugging to show any debug output from AsterNET. 

Add the following to your app,conf 

<system.diagnostics> 
<trace autoflush="false" indentsize="4"> 
<listeners> 
<add name="EventLogListener" type="System.Diagnostics.XmlWriterTraceListener"
              initializeData="c:\asternet.svclog" />
</listeners> 
</trace> 
</system.diagnostics> 

This will create a log file in the path above, of course it might be very large depending on how busy your server is.
Nov 25, 2014 at 8:40 AM
Blimey! Its working ;)