I did read
this article, but does not sounds like what I'm after (Rather have something I don't have to call everywhere in my code)
Someone know a proper article walking you trhough the process of logging api calls, etc preferably using log4net (since that allready in use in my project)
My API get called by a Mobile App. Mobile App Developed by another company in another city. API by me. I have no way to "debug" the mobile app.
I got a "Sandbox" client for my API (static html / jquery).
Many times (like this morning again) I get a client having some issue. When I use the mobile app, I have the same issue, but when using my sandbox all is fine.
So the problem is I do not know what the mobile app have posted to my API.
Was hoping to log something like : Time | Controller | Action | Input[] | Output[]
This would allow me to see what de frak de bloody mobile app sent over so I can see where is the problem.
needless to say, but now we are not on good foot..the mobile guys and me with blames kept flying back and forth when issues arrise.
Not to mention weekends when none of them are available and I spent hours with a client hoping to get behind an issue.
krokonoster
Contributor
4291 Points
1352 Posts
Logging API usage, errors, etc
Dec 05, 2012 10:13 AM|LINK
Hi,
I did read this article, but does not sounds like what I'm after (Rather have something I don't have to call everywhere in my code)
Someone know a proper article walking you trhough the process of logging api calls, etc preferably using log4net (since that allready in use in my project)
Cheers
panesofglass
Participant
758 Points
242 Posts
Re: Logging API usage, errors, etc
Dec 05, 2012 12:37 PM|LINK
krokonoster
Contributor
4291 Points
1352 Posts
Re: Logging API usage, errors, etc
Dec 05, 2012 12:41 PM|LINK
Thanks a lot for that. did not come up iin my searches.
Is there some documentation on what this one does?
panesofglass
Participant
758 Points
242 Posts
Re: Logging API usage, errors, etc
Dec 05, 2012 04:12 PM|LINK
krokonoster
Contributor
4291 Points
1352 Posts
Re: Logging API usage, errors, etc
Dec 06, 2012 11:37 PM|LINK
Simple enough, thanks. Will implement.
krokonoster
Contributor
4291 Points
1352 Posts
Re: Logging API usage, errors, etc
Dec 06, 2012 11:57 PM|LINK
Works great, thanks.
public class AccessController : ApiController { private readonly ITraceWriter _traceWriter; public AccessController() { _traceWriter = GlobalConfiguration.Configuration.Services.GetTraceWriter(); } [HttpGet] public Boolean Ping() { _traceWriter.Info(Request, ControllerContext.ControllerDescriptor.ControllerType.FullName, "Site Pinged"); return true; } }Allready have log4net configured in project (using S#arpLite)
Only issue now is SharpLite logging 100's of other things and my stuff in between.
Don't know much about log4net and will research, but if you got advice?
<log4net> <appender name="LogToFile" type="log4net.Appender.FileAppender"> <file value="../../logs/xxxxx.Web.Api.log" /> <appendToFile value="false" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5l - %m%n%n" /> </layout> </appender> <root> <!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF --> <priority value="INFO" /> <appender-ref ref="LogToFile" /> </root> </log4net>once get it figured will store to db table of course.
christiandev
Star
8607 Points
1841 Posts
Re: Logging API usage, errors, etc
Dec 07, 2012 11:51 AM|LINK
The reference is here: http://netcommon.sourceforge.net/docs/2.1.0/reference/pdf/netcommon-reference.pdf
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)
panesofglass
Participant
758 Points
242 Posts
Re: Logging API usage, errors, etc
Dec 07, 2012 01:50 PM|LINK
What are you trying to do exactly?
krokonoster
Contributor
4291 Points
1352 Posts
Re: Logging API usage, errors, etc
Dec 08, 2012 09:47 AM|LINK
Ok here's the plan:
My API get called by a Mobile App. Mobile App Developed by another company in another city. API by me. I have no way to "debug" the mobile app.
I got a "Sandbox" client for my API (static html / jquery).
Many times (like this morning again) I get a client having some issue. When I use the mobile app, I have the same issue, but when using my sandbox all is fine.
So the problem is I do not know what the mobile app have posted to my API.
Was hoping to log something like : Time | Controller | Action | Input[] | Output[]
This would allow me to see what de frak de bloody mobile app sent over so I can see where is the problem.
needless to say, but now we are not on good foot..the mobile guys and me with blames kept flying back and forth when issues arrise.
Not to mention weekends when none of them are available and I spent hours with a client hoping to get behind an issue.
Make sense?