How to enable logging?
|
<< Click to Display Table of Contents >> Navigation: Gnostice Document Studio .NET > Frequently Asked Questions (FAQs) > ASP.NET > How to enable logging? |
Server-side logging
Here are the steps to enable server-side logging in your ASP.NET web application
1.Set up log4net to initialize itself from the XML configuration by placing the following statement in your application start.
log4net.Config.XmlConfigurator.Configure();
2.Add the following configuration statement to Web.config file within the <configSections> block
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
3.Add the following configuration statements to Web.config file within the main <configuration> block but after the <configSections> block
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs\gnosticelog.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
4.Run the application. The log file (logs\gnosticelog.txt) should appear in the application root folder.
Client-side logging
Here are the steps to enable browser logging in ASP.NET document viewer
To enable logging at “INFO” level, set the following property to true:
logger.infoLogsEnabled = true;
To enable logging at “ERROR” level, set the following property to true:
logger.errorLogsEnabled = true;
This can be enabled while initializing DocumentViewer control
gnostice.logger.infoLogsEnabled = true;
var documentViewer = new gnostice.DocumentViewer('doc-viewer-id');
or it can also be done in console window of the browser.