Hello Everyone:
I am having a problem getting Log4Net to log because a particular Guid parameter I am using. Here is what I have in my config file: <parameter> <parameterName value="@messageID" /> <dbType value="Guid" /> <size value="10" /> <layout type="log4net.Layout.PatternLayout" value="%property{QueryServiceMessageID}" /> </parameter> Here is my property in code: Guid messageID = new Guid("7d32ea24-289c-48d7-9037-7c3caa75a87c"); log4net.GlobalContext.Properties["QueryServiceMessageID"] = messageID; Here is the stack trace I am getting through internal debugging: log4net:ERROR [AdoNetAppender] Exception while writing to database System.InvalidCastException: Failed to convert parameter value from a String to a Guid. ---> System.InvalidCastException: Invalid cast from 'System.String' to 'System.Guid'. at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) at System.String.System.IConvertible.ToType(Type type, IFormatProvider provider) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) --- End of inner exception stack trace --- at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) at System.Data.SqlClient.SqlParameter.GetCoercedValue() at System.Data.SqlClient.SqlParameter.Validate(Int32 index) at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters) at System.Data.SqlClient.SqlCommand.BuildPrepExec(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at log4net.Appender.AdoNetAppender.SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) Can anyone make any recommendations or point out any errors? Any help is much appreciated. Kevin Parkinson