Knowledgebase
How to Enable Verbose Logging
Posted by Diane Hancock on 20 November 2017 05:16 PM

Adams 5.7 and Later

NLog is used for verbose logging.  A default nlog configuration file is installed with each application. 

Enable Logging

To enable logging:

  1. Adams 5.7-5.8 Only: Set VerboseLogging to true as done prior to 5.7 (see sections below).  This step does not apply to Adams Bridge or Adams 5.9 or later.  In Adams 5.9 or later, the VerboseLogging value is ignored.
  2. Add to or uncomment in the NLog configuration file (see "Where to Find the NLog Configuration File") the following line: <logger name="*" minlevel="debug" maxLevel="debug" writeTo="logfile" final="true" />
  3. Recycle the application pool or restart the desktop application
  4. DeviceGateway only: create a Logs directory in the DeviceGateway installation directory (e.g. c:\inetpub\wwwroot\DeviceGateway\Logs)

That is it.  The subsequent sections give additional information if needed.

Where to Find the NLog Configuration File

Web Applications

The nlog configuration file is called web.nlog. and is located in the same directory the application's web.config. 

If this is missing, then nlog looks for a nlog.config in the bin directory.

Desktop Applications

The nlog configuration file is called nlog.config.

NLog Configuration File Information

The NLog configuration file defines the name of the log file (e.g. debuglog.txt), the format the messages and what messages are written to the log.

<target> elements define the name of the log file and the format of the messages

<logger> elements define rules that determine which Verbose Log messages to write to the file.  The <logger> rules are sequentially evaluated individually not collectively.  When a rule matches, irrelevant of other rules, the message is written.  To stop the application of further rules once a rule matches, include the final="true" attribute.

name attribute defines the category of message.  Use an asterisk (i.e. *) to write all categories of messages.  Supported categories are included in the temple log files.

minlevel attribute defines what type of messages to write.  Levels supported: error, warn, info, debug, trace, off.  Everything at and to the left of the specified level are written.  In other words, if minlevel="debug" then all error, warn, info and debug messages will be written unless a maxLevel is included. To exclude a category of message, then set the name to the category, the minLevel to off, and final to true.

maxLevel attribute defines the maximum level of message that will be written.  Therefore, to make a rule apply only to debug type messages, set minLevel to debug and maxLevel to debug

If the nlog configuration file was not installed with the application, then copy one from another Foray application that has it.

Examples:

  • To create a debuglog.txt file: <target name="logfile" xsi:type="File" fileName="debugLog.txt" layout="${longdate} ${level} ${windows-identity} ${message}"/>
  • To write all verbose logging messages to the file: <logger name="*" minlevel="debug" maxLevel="debug" writeTo="logfile" final="true" />
  • To write only Authentication verbose logging messages, include this and remove other <logger> lines with minLevel="debug"<logger name="Authentication" minlevel="debug" writeTo="logfile" />

Prior to Adams 5.7

Verbose Logging is always output to: debuglog.txt

The way to enable is dependent on the type of application as described in the following sections.

Web applications (e.g. Adams Web)

In the web.config file, set the VerboseLogging configuration setting to true.

After changing the setting, recycle the application pool.

Desktop applications (e.g. Digital Workplace)

In the configuration file: <application name>.exe.config (replace <application name> with the name of the application), set the VerboseLogging configuration setting to True

OR

\v on command line

ClickOnce applications (e.g. Adams Bridge)

Run this command replacing <username> with the user's profile name:

"C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Foray Adams Bridge.appref-ms" /signalrtrace,/v


Comments (0)