Logging#
This section describes how to configure the log verbosity and tracing mechanisms for monitoring and troubleshooting analysis.
Host Logging#
log4net Configuration#
The log4net framework allows to manipulate configuration data relatively easy. By default the host services log only errors to a file.
<appender name="cmfErrorFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="Host.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="100" />
<maximumFileSize value="20MB" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<IgnoresException value="False" />
<conversionPattern value="[%date] [%thread] [%-5level]%newlineCategory: %property{Category}%newlineUserName: %property{User}%newlineTenantName: %property{TenantName}%newlineHostName: %property{HostName}%newlineUniversalMessage: %property{UniversalMessage}%newlineMessage: %message%newlineException: %exceptionInnerException: %property{InnerException}" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ERROR" />
<levelMax value="FATAL" />
</filter>
</appender>
The above configuration generates a log file like:
[2018-02-27 22:41:56,981] [4] [ERROR]
Category: Cache
UserName: ######
TenantName: #######
HostName: #####
UniversalMessage: The data for the EntityType with Id=1712301249190000052 was not found in the system.
Message: The data for the EntityType with Id=1712301249190000052 was not found in the system.
Exception:
Message = The data for the EntityType with Id=1712301249190000052 was not found in the system.
StackTrace = at Cmf.Foundation.BusinessObjects.EntityType.DatabaseLoadAndValidation(CmfEntities model, Boolean IsOnlyGetInfo) in E:\Agents\A6\2\s\Biz\Core\BusinessObjectsBase\EntityType\EntityType.cs:line 4353
at Cmf.Foundation.BusinessObjects.EntityType.DatabaseLoadAndValidation(CmfEntities model) in E:\Agents\A6\2\s\Biz\Core\BusinessObjectsBase\EntityType\EntityType.cs:line 3645
at Cmf.Foundation.BusinessObjects.CacheManager.EntityTypeObjectCache.GetFromDatabase(EntityType entity) in E:\Agents\A6\2\s\Biz\Core\BusinessObjectsBase\CacheManager\EntityTypeObjectCache.cs:line 97
at Cmf.Foundation.BusinessObjects.CacheManager.EntityTypeObjectCache.Reload(EntityType entityType) in E:\Agents\A6\2\s\Biz\Core\BusinessObjectsBase\CacheManager\EntityTypeObjectCache.cs:line 179
at Cmf.Foundation.BusinessObjects.CacheManager.EntityTypeObjectCache.ReloadLoad(Int64 id) in E:\Agents\A6\2\s\Biz\Core\BusinessObjectsBase\CacheManager\EntityTypeObjectCache.cs:line 223
at Cmf.Foundation.BusinessObjects.CacheManager.EntityTypeObjectCache.Remove(Int64 entityId) in E:\Agents\A6\2\s\Biz\Core\BusinessObjectsBase\CacheManager\EntityTypeObjectCache.cs:line 323
at Cmf.Foundation.Common.CmfCacheManager`2.RemoveFromCache(Int64 id) in C:\Product\CoreBiz\Biz\Core\Common\Cache\CmfCacheManager.cs:line 392
at Cmf.Foundation.Services.Host.Handlers.MulticastHandler.ProcessEntityTypeCache(List`1 cacheEntryNames, List`1 cacheEntryIds) in E:\Agents\A6\2\s\Biz\Services\Hosting\ServiceHost\Handlers\MulticastHandler.cs:line 312
at Cmf.Foundation.Services.Host.Handlers.MulticastHandler.InvalidateCache(String msg) in E:\Agents\A6\2\s\Biz\Services\Hosting\ServiceHost\Handlers\MulticastHandler.cs:line 1065
Source = Cmf.Foundation.BusinessObjects
For more advanced settings please refer to log4net official documentation ⧉.
Service Trace Viewer#
Windows Communication Foundation (WCF) Service Trace Viewer helps you analyze activity tracing (*.svclog) diagnostic traces that are generated by WCF listeners. Service Trace Viewer provides a way to easily merge, view, and filter trace messages so that you can diagnose, repair, and verify WCF service issues. Please refer to the article Service Trace Viewer ⧉ manual for more information