Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / Windows Forms

Clog: Client Logging, WPF Edition

Rate me:
Please Sign up or sign in to vote.
4.51/5 (68 votes)
25 Dec 2008LGPL312 min read 156.1K   964   114  
A customizable log provider system that allows you to harness your existing logging system to log client side messages to your server using WCF. Includes WPF sample applications.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<configSections>
		<!-- Client Logging section -->
		<section name="ClientLogging" type="Orpius.Logging.Configuration.ClientLoggingConfigSection, Orpius.Logging" requirePermission="false"/>
	</configSections>
	
	<system.serviceModel>
		<bindings>
			<wsHttpBinding>
				<binding name="WSHttpBinding_IClogService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
					<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
					<reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
					<security mode="Message">
						<transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
						<message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
					</security>
				</binding>
			</wsHttpBinding>
		</bindings>
		<client>
			<endpoint address="http://localhost:2099/ClogService.svc" binding="wsHttpBinding"
                bindingConfiguration="WSHttpBinding_IClogService" contract="ClogServiceReference.IClogService"
                name="WSHttpBinding_IClogService">
				<identity>
					<userPrincipalName value="SOJUZ\Daniel" />
				</identity>
			</endpoint>
		</client>
	</system.serviceModel>
	
	<ClientLogging defaultProvider="WpfProvider" debug="true">
		<providers>
			<clear />
			<add name="WpfProvider" type="Orpius.Logging.LogStrategyProvider, Orpius.Logging"
				LogStrategy="Orpius.Logging.LogStrategies.ClientStrategy, Orpius.Logging" />
		</providers>
		<filters>
			<!--
				Use the action attribute to invert the behaviour of a filter. 
				Action can be set to either Deny or Allow.
			-->
			
			<!-- Uncomment to restrict logging to business hours. -->
			<!--<add name="TimeRange" type="Orpius.Logging.Filters.TimeRangeFilter, Orpius.Logging"
				begin="09:00" end="17:30"/>-->
			
			<!-- Prevent users identified by Environment.UserName. -->
			<add name="DenyUsers" type="Orpius.Logging.Filters.EnvironmentUserFilter, Orpius.Logging"
				users="UserName1,UserName2,UserName3,UserName4" action="Deny"/>

			<!-- Prevent machines identified by Environment.MachineName. -->
			<add name="DenyMachines" type="Orpius.Logging.Filters.MachineFilter, Orpius.Logging"
				machines="AnExampleMachineName1,AnExampleMachineName2" action="Deny"/>
		</filters>
	</ClientLogging>
	
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Engineer
Switzerland Switzerland
Daniel is a former senior engineer in Technology and Research at the Office of the CTO at Microsoft, working on next generation systems.

Previously Daniel was a nine-time Microsoft MVP and co-founder of Outcoder, a Swiss software and consulting company.

Daniel is the author of Windows Phone 8 Unleashed and Windows Phone 7.5 Unleashed, both published by SAMS.

Daniel is the developer behind several acclaimed mobile apps including Surfy Browser for Android and Windows Phone. Daniel is the creator of a number of popular open-source projects, most notably Codon.

Would you like Daniel to bring value to your organisation? Please contact

Blog | Twitter


Xamarin Experts
Windows 10 Experts

Comments and Discussions