This project is read-only.

How to include SilverlightLogging into your client project

1. Add a reference to the library
For Windows Phone 7: VXCompany.SilverlightLogging.WP7.dll
For Silverlight 4: VXCompany.SilverlightLogging.SL4

2. Add the block in your app.xaml file (sample: App.Xaml)

3. Optionally add the LogStatusControl usercontrol to your page.
Sample XAML:

<UserControl x:Class="VXCompany.SilverlightLogging.SLTestUI.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lv="clr-namespace:VXCompany.SilverlightLogging.MVVM.Views;assembly=VXCompany.SilverlightLogging.SL4"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">

<Grid x:Name="LayoutRoot" Background="White">
<lv:LogStatusControl x:Name="logStatus" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
</UserControl>

4. Make sure the file ServiceReferences.ClientConfig in your entry project has the correct service URL.
The default location is: http://localhost/VXCompany.SilverlightLogging.Services/LoggingService.svc

5. Test your configuration by attempting to log your first exception:

try
{
throw new Exception("Generated Exception from LogStatusControl.");
}
catch (Exception ex)
{
ExceptionPolicy.Current.HandleException(ex, ServiceProxy.ErrorLevel.Critical);
}

...or click the button 'Create Error' on the usercontrol, which does the same.

Last edited Nov 23, 2010 at 4:54 PM by lduys, version 4

Comments

lduys Jan 5, 2011 at 12:16 PM 
There's no true support for tracing. But, you can wrap your information in an Exception and use the Level property to mark it as Informational or Warning. You can alter the service to handle these messages differently. (store in text file for instance)

ikujundzic Nov 30, 2010 at 9:51 AM 
Hi,
can I log something other than Exception?
E.g. debugging info, string messages etc.