logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bloom, Joshua (CASE)" <Joshua.Bl...@VOLPE.DOT.GOV>
Subject RE: MDC when using remoting
Date Fri, 15 Jul 2005 20:04:50 GMT
I haven't worked with your setup personally but I would check User
permissions and see what user is attempting to perform the database
connection.
 
A quick way to test if this is a road to pursue is to change your Connection
String to use a SQL username and password, rather than Windows integrated
security.
 
Good luck,
Josh
 
 
 -----Original Message-----
From: Deepanjan Ganguly [mailto:Deepanjan.Ganguly@DTAG.Com]
Sent: Friday, July 15, 2005 3:54 PM
To: log4net-user@logging.apache.org
Subject: FW: MDC when using remoting 


Hi,
 
I have been using log4net beta 8 for sometime now with several different
Appenders and they work great. I am now trying to use the remoting appender
and I am experiencing some problems with ADONetAppender. Here's what is
happening.
 
I have a windows service which hosts the log4net on the server. It is set up
to use ADONetAppender and LogFileAppender. 
On the client side the remoting appender is set up. 
On the client I am setting to properties using the MDC. These values are set
properly and I can see it the LogFile on the server, however I don't see
them in the table (sql server)
When I modified the client to use the adonetappender, I can see these two
values in the table also. This proves that the configuration for the
database and the table is correct.
What am I doing wrong here? that it does not update when I am using
remoting? Any help is appreciated. I am attaching the configuration setup
for adoappender and logfileappender. The "Client" and "User" are the two
context info which need to be in the table. 
 
Thanks for all the help
============================================================================
===============================
<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="Log File Initialized\r\n" />
                                                <param name="Footer"
value="Log File Closed\r\n" />
                                                <param
name="ConversionPattern" value="%d [%t] %-5p %c %X{User} %X{Client}
(%P{hostname}) [%x] - %m%n" />
                                    </layout>
</appender>
============================================================================
===============================
   <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>
 
Here's  what the client code is doing: I have just added part of the code.
 
..
..
MDC.Set ("User", Environment.UserDomainName+"/"+ Environment.UserName );
MDC.Set ("Client", Environment.MachineName ) ;
 
 
if (log.IsInfoEnabled) 
log.Info("Application [RemotingClient] Start");
....
....

Mime
View raw message