error logging - Log exceptions and events in Windows mobile 6.5.3 CF 3.5 -


i writing windows mobile (6.5.3) application on mc9190 device (cf 3.5). want log events (e.g. user login info) , runtime exceptions occurred. how can that? tried use log4net example http://breathingtech.com/2009/using-apache-log4net-in-net-compact-framework-projects/ cf 3.5 not supported. (http://logging.apache.org/log4net/release/framework-support.html). how can log events/exceptions in application? there standard log framework available cf 3.5? thank you.

writing simple logging not hard. regardless logging implement, need add line each exception or event want log. log4net , other frameworks full blown , support techniques not usable on compact framework (ie log system event log). must decide on own, if worth use framework cannot use of features supported in full framwork.

there more simple logging tools: http://blogs.msdn.com/b/davidklinems/archive/2006/08/17/704662.aspx

see also: logging library .net compact framework?

the problem log4net , it's compact framework support is not maintained on time (as other open source libs too).

getting working log4net compact framework easy:

  • open log4.net src/log4net.vs2008.sln
  • add new smartdevice class library project (wm5 sdk , cf2 ok) , name log4netcf
  • delete existing class1.cs file
  • change project properties: enter image description here assembly name , default namespace = "log4net"

  • now right click every source code folder in log4net.vs2008 project in solution explorer , select copy , right click log4netcf project , select paste repeat every single folder:

    • appender,
    • config,
    • core,
    • dateformatter,
    • filter,
    • layout,
    • objectrenderer,
    • plugin,
    • repository,
    • util
  • also copy single files:

    • assemblyinfo.cs
    • assemblyversioninfo.cs
    • globalcontext.cs
    • ilog.cs
    • logicalthreadcontext.cs
    • logmanager.cs
    • mdc.cs
    • ndc.cs
    • threadcontext.cs

    from log4net.vs2008 log4netcf project.

  • delete properties/assemblyinfo.cs in log4netcf project
  • add pocketpc;netcf_2_0;netcf build options of log4netcf enter image description here

now right click log4netcf project , select build. should build without error , have working compact framework 2.0 log4net assembly.

a dropin of project file available @ www.hjgode.de/temp/log4netcf.csproj. download , place subversion copy of log4net src folder beside log4net.vs2008.csproj file.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -