logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Remoting and Adonetappender
Date Fri, 22 Jul 2005 19:15:09 GMT
Can you try adding the following to the config for the AdoNetAppender
used to log the event after it is received via remoting:

<fix value="None" />

Let me know if this has any effect. 

Thanks,
Nicko

> -----Original Message-----
> From: Deepanjan Ganguly [mailto:Deepanjan.Ganguly@DTAG.Com] 
> Sent: 22 July 2005 15:18
> To: Log4NET User
> Subject: RE: Remoting and Adonetappender 
> 
> Nicko,
> Thanks for your response. When I use the LogFileAppender it 
> logs the property values when remoting is used. However when 
> a buffering appender is used e.g. adonetappender, the 
> property does not get stored. There are no internal errors 
> thrown as well. While debugging I found that the MDC gets 
> cleared in the BufferingSkeleton.cs at the following code 
> when I use remoting.
> =========================================
> if (m_bufferSize <= 1)
> {
>  // Only send the event if we are in non lossy mode or the 
> event is a triggering event
> if ((!m_lossy) ||	(m_evaluator != null &&
> m_evaluator.IsTriggeringEvent(loggingEvent)) || 
> (m_lossyEvaluator != null && 
> m_lossyEvaluator.IsTriggeringEvent(loggingEvent)))
> 	{
> 	 if (m_eventMustBeFixed)
> 					{
> 		// Derive class expects fixed events
> 		loggingEvent.Fix = this.Fix;  //// ***THIS IS 
> WHERE THE MDC VALUE IS CLEARED IN REMOTING**////
> 					}
> 
> // Not buffering events, send immediatly
> 	SendBuffer(new LoggingEvent[] { loggingEvent } );
> 				}
> 			}
> ===========================================
> I have set the buffersize to 1. So when SendBuffer is called 
> when remoting is used loggingEvent object does not have the 
> property values in it.
> However when I use the adonetappender directly I don't get 
> this problem.
> 
> 
> The two properties I am setting are "User" and "Client" in my example.
> Here is config file I use on the client side. I have commented out the
> one of the appenders in the client side based on whether I do remoting
> or direct adonetappender.
> ===================================================================
> 
> 
> ===================================================================
> Here's the server side config. I have both LogFileAppender and
> adonetappender configured. As I said before all the property 
> values show
> up correctly on the logfileappender during use of remoting.
> ==============================================================
> ==========
> ====
> 
> 	<log4net debug="true">
> 		<appender name="ConsoleAppender"
> type="log4net.Appender.ConsoleAppender">
> 			<layout type="log4net.Layout.PatternLayout">
> 				<param name="ConversionPattern"
> value="%d [%t] %-5p %c %X{User} %X{Client} (%P{hostname}) [%x] - %m%n"
> />
> 			</layout>
> 		</appender>
> 		<appender name="LogFileAppender"
> type="log4net.Appender.FileAppender">
> 			<param name="File" value="log-file.txt" />
> 			<param name="AppendToFile" value="true" />
> 			<layout type="log4net.Layout.PatternLayout">
> 				<param name="Header" value="Reservation
> Log File Initialized\r\n" />
> 				<param name="Footer" value="Reservation
> Log File Closed\r\n" />
> 				<param name="ConversionPattern"
> value="%d [%t] %-5p %c %X{User} %X{Client} (%P{hostname}) [%x] - %m%n"
> />
> 			</layout>
> 		</appender>
> 		    <!-- ADONetAppender -->
>     <appender name="ADONetAppender"
> type="log4net.Appender.ADONetAppender"> 
> 	 <bufferSize value="1" /> 
>   	 <connectionType value="System.Data.SqlClient.SqlConnection,
> System.Data, Version=1.0.3300.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089" /> 
> 	 <connectionString value="server=TWEB01\\RESGUI;
> database=ResDevlDb;Integrated Security=Yes;persist security info=true"
> /> 
> 	 <commandText value="INSERT INTO Res_AppLog
> ([Date],[Level],[Logger],[User],[Message],[Exception],[Client]) VALUES
> (@log_date, @log_level, @logger,@user, @message, @exception, @client)"
> /> 
> 	 <parameter>  
> 		<parameterName value="@log_date" />  
> 		<dbType value="DateTime" />  
> 		<layout type="log4net.Layout.RawTimeStampLayout" /> 
>  	 </parameter> 
> 	 <parameter>  
> 	  <parameterName value="@log_level" />  
> 	  <dbType value="String" />  
> 	  <size value="50" />  
> 	  <layout type="log4net.Layout.PatternLayout">   
> 		<conversionPattern value="%p" />  
> 	  </layout> 
> 	 </parameter> 
> 	 <parameter>  
> 	  <parameterName value="@logger" />  
> 	  <dbType value="String" />  
> 	  <size value="255" />  
> 	  <layout type="log4net.Layout.PatternLayout">   
> 		<conversionPattern value="%c" />  
> 	  </layout> 
> 	 </parameter>
> 	 <parameter>
> 	  <parameterName value="@user" />  
> 	   <dbType value="String" />  
> 	   <size value="50" />  
> 	   <layout type="log4net.Layout.PatternLayout">   
> 		<conversionPattern value="%X{User}" />  
> 	   </layout> 
> 	  </parameter>  
> 	  <parameter>  
> 	   <parameterName value="@message" />  
> 	   <dbType value="String" />  
> 	   <size value="4000" />  
> 	   <layout type="log4net.Layout.PatternLayout">   
> 		<conversionPattern value="%m" />  
> 	   </layout> 
> 	  </parameter> 
> 	  <parameter>  
> 	   <parameterName value="@exception" />  
> 	   <dbType value="String" />  
> 	   <size value="2000" />  
> 	   <layout type="log4net.Layout.ExceptionLayout" /> 
> 	  </parameter>
> 	  	 <parameter>
> 	  <parameterName value="@client" />  
> 	   <dbType value="String" />  
> 	   <size value="50" />  
> 	   <layout type="log4net.Layout.PatternLayout">   
> 		<conversionPattern value="%X{Client}" />  
> 	   </layout> 
> 	  </parameter> 
> 	 </appender>
> 		<root>
> 			<level value="DEBUG" />
> 			<appender-ref ref="LogFileAppender" />
> 			<appender-ref ref="ADONetAppender" />
> 		</root>
> 	</log4net>
> 	<system.runtime.remoting>
> 		<application name="ResLoggingSvcs">
> 			<!-- We need to define the remoting channels on
> which we will publish
>            the remote logging sink. -->
> 			<channels>
> 				<channel displayName="Server Channel"
> ref="tcp server" port="8086" />
> 			</channels>
> 		</application>
> 	</system.runtime.remoting>
> ==============================================================
> =========
> 
> 
> Thanks again!
> Deep
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Nicko Cadell [mailto:nicko@neoworks.com] 
> Sent: Friday, July 22, 2005 6:58 AM
> To: Log4NET User
> Subject: RE: Remoting and Adonetappender 
> 
> What do your 2 log4net configuration files look like?
> 
> In your receiving app what happens if you add a FileAppender 
> that would
> log the property values, for example:
> 
> <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
>   <file value="log-file.txt" />
>   <layout type="log4net.Layout.PatternLayout">
>     <conversionPattern value="%d %-5p %c %X{YourPropertyName} 
> - %m%n" />
>   </layout>
> </appender> 
> 
> Nicko
> 
> > -----Original Message-----
> > From: Deepanjan Ganguly [mailto:Deepanjan.Ganguly@DTAG.Com] 
> > Sent: 21 July 2005 21:32
> > To: Log4NET User
> > Subject: Remoting and Adonetappender 
> > 
> > I am seeing a difference when I use remoting with 
> > adonetappender. All values set with MDC (beta8 version) are 
> > missing from the table. All the other fields are populated. 
> > However when I use adonetappender directly all the mdc values 
> > are being stored. 
> > 
> > Any idea why this might be happening?
> > 
> > Thanks
> > 
> > 
> 
> 
> 

Mime
View raw message