Get Started!

Viewing the Canvas Application Log

Each instance of Canvas has a daily log file, which can be written to via any C#, can be viewed via .dash UI.

 

Clicking the button with the icon opens the viewer and attaches to the Logger write events.

Clicking it again closes the viewer & detaches the listeners from the logger's write events.

Example output

The above contains the following entries

08:13:28 User [net4orce_sys] - Side nav viewing : dataitem
08:13:29 User [net4orce_sys] - Side nav viewing : dataserver
08:13:29 User [net4orce_sys] - Side nav viewing : dataitemref
08:13:30 User [net4orce_sys] - Side nav viewing : dataitemsref
08:13:31 User [net4orce_sys] - Side nav viewing : net4orceapp
08:13:33 User [net4orce_sys] - Side nav viewing : projects
08:13:34 User [net4orce_sys] - Side nav viewing : sites
08:13:34 User [net4orce_sys] - Side nav viewing : backups

These were generated via the following statement on one of SideNav control of the docs site:

Net4orceApp.oLogger.WriteString(
  "Side nav viewing : " + oWebPage.cName.SlugValue
);

Remember to include reference to the Core namespace:

using Net4orce.Core;

Including user details

Using the Log method, with the User and a message the logger will automatically include the user info in the line. For example :

Net4orceApp.oLogger.Log(
  oSession.oUser,
  "Side nav viewing : {0}",
  oWebPage.cName.SlugValue
);

The code above would generate the following output.

08:28:08 User [andrew] - Side nav viewing : dataserver
08:28:08 User [andrew] - Side nav viewing : net4orceapp
08:28:12 User [andrew] - Side nav viewing : dataitemsref
08:28:13 User [andrew] - Side nav viewing : sites
08:28:14 User [andrew] - Side nav viewing : log-viewer

Here you can see how I've navigated through some sections

What about non-authenticated users ?

08:28:40 User [net4orce_sys] - Session Start 123.123.123.123
08:28:40 User [guest] - Side nav viewing : log-viewer

The two lines above these relate to me opening a link in an incognito window. It includes details about a new session but no user name is included, instead the value guest is used.