Skip to main content
Mitratech Success Center

Temporarily Enabling Debug Mode on WinApp (Internal)

Enabling Trace Mode for WinApp- Internal

This documentation is intended for internal support use only- not customers

CMO Mobile applications use OpenSource logging frameworks which all are controlled via XML files which act as configuration settings. By default they only log errors or warnings but they can be configured to log verbose information such as for use in Debugging and Stack Tracing.

Debugging and Stack Tracing should only be used as a temporary measure as it will slow down the performance of the application dramatically.

Background Details

This uses an error logging framework called NLog

https://github.com/NLog/NLog/wiki/Tutorial#log-levels

NLog supports the following log levels:

  • Trace - very detailed logs, which may include high-volume information such as protocol payloads. This log level is typically only enabled during development
  • Debug - debugging information, less detailed than trace, typically not enabled in production environment.
  • Info - information messages, which are normally enabled in production environment
  • Warn - warning messages, typically for non-critical issues, which can be recovered or which are temporary failures
  • Error - error messages - most of the time these are Exceptions
  • Fatal - very serious errors!

Instructions to set WinApp to Debug Mode

You can find a config file for Nlog in application files folder. In common cases it will looks like C:\Program Files (x86)\CMO\Cmo Windows App\Release\NLog.config.

<?xml version="1.0" encoding="utf-8" ?>

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"            
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"            
      autoReload="true"            
      throwExceptions="true">


    <targets async="true">        
        <target name="InfoLog" type="AsyncWrapper" queueLimit="5000"  overflowAction="Block">            
            <target xsi:type="File" fileName="${specialfolder:folder=ApplicationData}/CMO Windows App/Logs/${shortdate}/Log.log"                            
                    layout="${date:format=HH\:mm\:ss}   ${uppercase:${level}}   ${message}" keepFileOpen="true"/>        
        </target>

        <target name="DebugLog" type="AsyncWrapper" queueLimit="5000" overflowAction="Block"> 
            <target xsi:type="File" fileName="${specialfolder:folder=ApplicationData}/CMO Windows App/Logs/${shortdate}/DebugLog.log"  
                    layout="${date:format=HH\:mm\:ss}   ${uppercase:${level}}   ${message} ${exception:format=ToString}" keepFileOpen="true"/>        
        </target>
    </targets>

    <rules>        
        <logger name="*" minlevel="Info" writeTo="InfoLog" />        
        <logger name="*" minlevel="Debug" writeTo="DebugLog" />    
    </rules>

</nlog>
  • Was this article helpful?