NLog
- coralogix
- November , 2016,11
Private Key – A unique ID which represents your company, this Id will be sent to your mail once you register to Coralogix.
Application Name – The name of your main application, for example, a company called “SuperData” would probably insert the “SuperData” string parameter or if they want to debug their test environment they might insert the “SuperData– Test”.
SubSystem Name – Your application probably has multiple subsystems, for example, Backend servers, Middleware, Frontend servers, etc. to help you examine the data you need, inserting the subsystem parameter is vital.
<?xml version="1.0" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <extensions> <add assembly="CoralogixNLog"/> </extensions> <targets> <target name="console" xsi:type="CoralogixNLog" PrivateKey="9626c7dd-8174-5015-a3fe-5572e042b6d9" ApplicationName="MyTestApp" SubsystemName="BL" layout="${date:format=HH\:MM\:ss} ${logger} ${message}" /> </targets> <rules> <logger name="*" minlevel="Info" writeTo="console" /> </rules> </nlog>
LoggingConfiguration config = new LoggingConfiguration(); CoralogixTarget coralogixTarget = new CoralogixTarget(); config.AddTarget("Coralogix", coralogixTarget); //Configure the Croalogix target with the Coralogix settings. //You need to configure this only once. coralogixTarget.PrivateKey = "9626c7dd-8174-5015-a3fe-5572e042b6d9"; coralogixTarget.ApplicationName = "MyTestApp"; coralogixTarget.SubsystemName = "BL"; coralogixTarget.Layout = @"${date:format=HH\:mm\:ss} ${logger} ${message}"; //Configure the Level filter for the Coralogix Target var rule1 = new LoggingRule("*", NLog.LogLevel.Debug, coralogixTarget); config.LoggingRules.Add(rule1); // Define the actual NLog logger which through it all log entires should be reported NLog.LogManager.Configuration = config; // The common practice is to get an instance of the logger in each class and setting the logger name to the class name. //logger name will be used as category unless specified otherwise. NLog.Logger nlogger = NLog.LogManager.GetLogger("MyApp"); nlogger.Debug("Hello world"); nlogger.Info("Hello world"); nlogger.Warn("Hello world"); nlogger.Error("Hello world"); nlogger.Trace("Hello world");
Need help? We love to assist our customers, simply book your implementation session, and we will walk you through, step by step.
Signup to Coralogix