Change of standard logging mechanism to NLog

Introduction

NLog is an open-source and lightweight logging platform with rich log routing and management capabilities.
NLog is also easy to configure, it is extendable and supports a clean code-based configuration.

 

Main Advantages of NLog

  • It is easy to configure.
  • It improves performance by sending logs asynchronously - according to our testing, the performance improvement of a new installation and start-up of Coresuite is 22-25% (measured on SAP Business One 10.0 FP2102 - MSSQL).
  • Log messages are much easier to read.

 

Important and Useful

  • The path of the log file is changed from %temp%  to %temp%/coresuite .
  • The name changes from coresuiteDebugLog.xml to coresuite-%CompanyDBName%.log .
  • Coresuite will create a new log file every day and the log file for the previous day will be archived in the same folder into a file with the name coresuite-%CompanyDBName%.Date.zip .
  • We are using NLog version 4.7.9 in our code. If you are using NLog also in your custom modules, please use the same version to avoid conflicts between versions.
  • If you are using Notepad++ for reading of logs, you can configure it as follows, which will differentiate various log events with colors, and thus improve the readability of the log.

Notepad++ configuration:

  1. In Notepad++, click on Language Define your language... :
    mceclip0.png
  2. Click on Create New... and enter a name for the language:
    mceclip1.png
  3. Switch to the Keywords Lists  tab in field Ext. type "log" so it is applied to all *.log files and enter the words that should be marked up in text boxes:
    mceclip7.png
  4. Choose the Styler  button for each keyword to define text formatting, in our example the background color:
    mceclip4.png
  5. Close the dialog boxes when finished.
  6. To apply the language onto the text in Notepad++, expand Language  from the upper menu and choose the language created in the previous steps:
    mceclip5.png
  7. An example of text (log file) with formatting applied:
    mceclip9.png

The same approach can be applied to facilitate any other text file review using keyword highlighting.

 

 

Was this article helpful?
3 out of 3 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.