RE: Setting ADONetAppender Parameter Layout Parameter in code...
"Adam Patacchiola" <[email protected]> Wed, 24 Mar 2004 08:52:54 -0700
| Newsgroups | gmane.comp.windows.dotnet.log4net.user |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C4117D.65C4D880 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Nevermind I found the problem, thanks. _____ From: [email protected] [mailto:[email protected]] On Behalf Of Adam Patacchiola Sent: Tuesday, March 23, 2004 2:05 PM To: [email protected] Subject: [Log4net-users] Setting ADONetAppender Parameter Layout Parameter in code... Hi, I'm trying to convert my ADONetAppender config file entries to code. The problem I am having is my parameters are using the PatternLayout to convert NDC values into parameters, and ADONetAppenderParameter.Layout is expecting an IRawLayout type, whereas PatternLayout implements the ILayout interface. How would I go about doing this? My config file is as below. <appender name="AuditAppender" type="log4net.Appender.ADONetAppender"> <param name="BufferSize" value="100" /> <param name="CommandType" value="StoredProcedure"/> <param name="ConnectionType" value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <param name="ConnectionString" value ="Omitted for posting..." /> <param name="CommandText" value="InsertAuditEntry" /> <param name="Parameter"> <param name="ParameterName" value="@FileID" /> <param name="DbType" value="Int32" /> <param name="Size" value="0" /> <param name="Layout" type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%X{FileID}" /> </param> </param> <param name="Parameter"> <param name="ParameterName" value="@UserID" /> <param name="DbType" value="Int32" /> <param name="Size" value="0" /> <param name="Layout" type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%X{UserID}" /> </param> </param> <param name="Parameter"> <param name="ParameterName" value="@Description" /> <param name="DbType" value="String" /> <param name="Size" value="1000" /> <param name="Layout" type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%m" /> </param> </param> </appender> Thanks, Adam ------=_NextPart_000_0006_01C4117D.65C4D880 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR></HEAD> <BODY> <DIV dir=3Dltr align=3Dleft><SPAN class=3D131355215-24032004><FONT = face=3DArial=20 color=3D#0000ff size=3D2>Nevermind I found the problem,=20 thanks.</FONT></SPAN></DIV><BR> <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> <HR tabIndex=3D-1> <FONT face=3DTahoma size=3D2><B>From:</B> = [email protected]=20 [mailto:[email protected]] <B>On Behalf Of = </B>Adam=20 Patacchiola<BR><B>Sent:</B> Tuesday, March 23, 2004 2:05 = PM<BR><B>To:</B>=20 [email protected]<BR><B>Subject:</B> [Log4net-users] = Setting=20 ADONetAppender Parameter Layout Parameter in = code...<BR></FONT><BR></DIV> <DIV></DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial=20 size=3D2>Hi,</FONT></SPAN></DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial=20 size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial size=3D2>I'm = trying to=20 convert my ADONetAppender config file entries to code. The problem I am = having=20 is my parameters are using the PatternLayout to convert NDC values into=20 parameters, and ADONetAppenderParameter.Layout is expecting an = IRawLayout type,=20 whereas PatternLayout implements the ILayout interface. How would I go = about=20 doing this? My config file is as below.</FONT></SPAN></DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial=20 size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D406425820-23032004> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>appender</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"AuditAppender"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>type</FONT><FONT=20 color=3D#0000ff>=3D"log4net.Appender.ADONetAppender"></P></FONT></FONT= > <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"BufferSize"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"1<SPAN = class=3D406425820-23032004>00</SPAN>"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"CommandType"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"StoredProcedure"/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ConnectionType"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"System.Data.SqlClient.SqlConnection, System.Data,=20 Version=3D1.0.5000.0, Culture=3Dneutral,=20 PublicKeyToken=3Db77a5c561934e089"</FONT><FONT color=3D#ff00ff> = </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ConnectionString"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT = color=3D#0000ff><SPAN=20 class=3D406425820-23032004><FONT color=3D#ff0000> =3D"Omitted for = posting</FONT><FONT=20 color=3D#0000ff>...</FONT></SPAN>"</FONT><FONT color=3D#ff00ff> = </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"CommandText"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"InsertAuditEntry"</FONT><FONT color=3D#ff00ff> = </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"Parameter"></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ParameterName"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"@FileID"</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"DbType"</FONT><FONT = color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"Int32"</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"Size"</FONT><FONT = color=3D#ff00ff>=20 </FONT><FONT color=3D#ff0000>value</FONT><FONT = color=3D#0000ff>=3D"0"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"Layout"</FONT><FONT = color=3D#ff00ff> </FONT><FONT color=3D#ff0000>type</FONT><FONT=20 color=3D#0000ff>=3D"log4net.Layout.PatternLayout"></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ConversionPattern"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"%X{FileID}"</FONT><FONT color=3D#ff00ff> = </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff></</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#0000ff>></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff></</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#0000ff>></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"Parameter"></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ParameterName"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"@UserID"</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"DbType"</FONT><FONT = color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"Int32"</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"Size"</FONT><FONT = color=3D#ff00ff>=20 </FONT><FONT color=3D#ff0000>value</FONT><FONT = color=3D#0000ff>=3D"0"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"Layout"</FONT><FONT = color=3D#ff00ff> </FONT><FONT color=3D#ff0000>type</FONT><FONT=20 color=3D#0000ff>=3D"log4net.Layout.PatternLayout"></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ConversionPattern"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"%X{UserID}"</FONT><FONT color=3D#ff00ff> = </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff></</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#0000ff>></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff></</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#0000ff>></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"Parameter"></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ParameterName"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"@Description"</FONT><FONT color=3D#ff00ff> = </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"DbType"</FONT><FONT = color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"String"</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"Size"</FONT><FONT = color=3D#ff00ff>=20 </FONT><FONT color=3D#ff0000>value</FONT><FONT = color=3D#0000ff>=3D"1000"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT color=3D#0000ff>=3D"Layout"</FONT><FONT = color=3D#ff00ff> </FONT><FONT color=3D#ff0000>type</FONT><FONT=20 color=3D#0000ff>=3D"log4net.Layout.PatternLayout"></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff><</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#ff0000>name</FONT><FONT = color=3D#0000ff>=3D"ConversionPattern"</FONT><FONT=20 color=3D#ff00ff> </FONT><FONT color=3D#ff0000>value</FONT><FONT=20 color=3D#0000ff>=3D"%m"</FONT><FONT color=3D#ff00ff> </FONT><FONT=20 color=3D#0000ff>/></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff></</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#0000ff>></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff></</FONT><FONT=20 color=3D#800000>param</FONT><FONT color=3D#0000ff>></P></FONT></FONT> <P><FONT size=3D2><FONT color=3D#0000ff></</FONT><FONT=20 color=3D#800000>appender</FONT><FONT=20 color=3D#0000ff>></P></FONT></FONT></SPAN></DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial=20 size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial=20 size=3D2>Thanks,</FONT></SPAN></DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial=20 size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D406425820-23032004><FONT face=3DArial=20 size=3D2>Adam</FONT></SPAN></DIV></BODY></HTML> ------=_NextPart_000_0006_01C4117D.65C4D880-- ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click