You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Gourlay, Colin" <cg...@ebs.hw.ac.uk> on 2008/11/06 12:59:28 UTC

SQL 2005 Database Mirroring Support

Does log4net support the database mirroring feature in SQL 2005?

It logs quite happily when logging to our primary database but when I failover logging ceases to work - in that nothing is logged - when I failback logging works as before.  The mirroring has been configured correctly (test has been done to verify this) so I think I can rule this out.

Other than the following entry (as per http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx) included in my connection string is there something else required?

failover partner=MyFailoverDatabaseServer

Is there anything else I should be considering?

Thanks in advance.

Colin





________________________________

Edinburgh Business School is a Charity Registered in Scotland, SC026900

Re: SQL 2005 Database Mirroring Support

Posted by Ron Grabowski <ro...@yahoo.com>.
The system.diagnostics node needs to go in App.Config. log4net produces quite a bit of internal debug messages even if there isn't a problem so you should at least be seeing that.




________________________________
From: "Gourlay, Colin" <cg...@ebs.hw.ac.uk>
To: Log4NET User <lo...@logging.apache.org>
Sent: Wednesday, November 12, 2008 7:05:01 AM
Subject: RE: SQL 2005 Database Mirroring Support

 
Hello.
 
When I turn on internal debugging
I get nothing at all.
 
This is a web application (using
Windows authentication) and the user has write permissions to the folder I
created where I wanted the log4net debugging output be rendered to.
 
In case this is significant I  added the following to the web.config file: <add key="log4net.Internal.Debug" value="true"/> 
  
And added the following to the logging.config file (the logging information is held in a separate config file).  I use ConfigureAndWatch() to pick up the changes but just to be sure that it picked up the additions I restarted the web site in IIS.
  
    <system.diagnostics>
        <trace autoflush="true">
            <listeners>
                <add 
                    name="textWriterTraceListener" 
                    type="System.Diagnostics.TextWriterTraceListener" 
                    initializeData="C:\tmp\log4net.txt" />
            </listeners>
        </trace>
    </system.diagnostics>
  
  
Any thoughts?
  
Colin
  
  
  
 
 
From:Ron Grabowski
[mailto:rongrabowski@yahoo.com] 
Sent: 11 November 2008 22:12
To: Log4NET User
Subject: Re: SQL 2005 Database Mirroring Support
Importance: Low
 
What does log4net report as the error when you turn on
internal debugging?
 

________________________________
 
From:"Gourlay, Colin"
<cg...@ebs.hw.ac.uk>
To: Log4NET User <lo...@logging.apache.org>
Sent: Tuesday, November 11, 2008 11:07:33 AM
Subject: RE: SQL 2005 Database Mirroring Support
Hi Dag.
 
Thanks for your response. 
Unfortunately I am still no further forward on this despite following your
suggestion.  I have included further information if this helps. 
Suggestions/Advice are very much appreciated.
 
Both servers are fully service
packed and are running with 
 
Log4Net  v1.2.10
SQL 2005
.Net 3.5 
 
My log4net configuration is as
follows:
 
<log4net>
                               
<root>
                                               
<level value="DEBUG" />
                                               
<appender-ref ref="LogToSqlServer"/>
                               
</root>
 
                               
<appender name="LogToSqlServer" type="log4net.Appender.AdoNetAppender">
                                                
                                               
<filter type="log4net.Filter.LoggerMatchFilter">
                                                               
<loggerToMatch value="NHibernate" />
                                                               
<acceptOnMatch value="false" />
                                               
</filter>
 
 
                                               
<bufferSize value="0"/>
                                               
<!--<threshold value="DEBUG"/>-->
                                               
<connectionType value="System.Data.SqlClient.SqlConnection,
System.Data, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
                                               
<connectionString value="data
source=<SERVER-NAME-IS-HERE>;initial
catalog=<LOGGING-DATABASE-IS-HERE>;integrated security=true;"/>
                                               
<commandText value="EXEC <STORED-PROC-NAME-IS-HERE> @User,
@Logger, @LoggingLevel, @Message"/>
                                               
<parameter>
                                                               
<parameterName value="@User"/>
                                                               
<dbType value="String"/>
                                                               
<size value="255"/>
                                                               
<layout type="log4net.Layout.PatternLayout">
                                                                               
<conversionPattern value="%identity"/>
                                                               
</layout>
                                               
</parameter>
                                               
<parameter>
                                                               
<parameterName value="@Logger"/>
                                                               
<dbType value="String"/>
                                                               
<size value="255"/>
                                                               
<layout type="log4net.Layout.PatternLayout"
value="%logger"/>
                                               
</parameter>
                                               
<parameter>
                                                               
<parameterName value="@LoggingLevel"/>
                                                               
<dbType value="String"/>
                                                               
<size value="50"/>
                                                               
<layout type="log4net.Layout.PatternLayout"
value="%level"/>
                                               
</parameter>
                                               
<parameter>
                                                               
<parameterName value="@Message"/>
                                                               
<dbType value="String"/>
                                                               
<size value="4000"/>
                                                               
<layout type="log4net.Layout.PatternLayout"
value="%message"/>
                                               
</parameter>
                               
</appender>
               
</log4net>
 
From:Dag Christensen
[mailto:Dag.Christensen@vismaretail.no] 
Sent: 06 November 2008 13:06
To: Log4NET User
Subject: RE: SQL 2005 Database Mirroring Support
Importance: Low
 
Should be handled transparently if you’re using SqlClient or
native client and a correct connection string. I think log4net uses OLE DB by
default, you might want to try changing this to SqlClient.
 
If it still doesn’t work, try setting your appender’s
ReconnectOnError to true.
 
It would also be helpful if you posted the versions you’re using
(log4net, SQL server 2005 service pack?, .NET framework version and service
pack?) and your log4net configuration.
 
Best wishes,
Dag
 
 
From:Gourlay, Colin
[mailto:cg1@ebs.hw.ac.uk] 
Sent: Thursday, November 06, 2008 12:59 PM
To: Log4NET User
Subject: SQL 2005 Database Mirroring Support
 
Does log4net support the database mirroring feature in SQL
2005? 
 
It logs quite happily when logging to our primary database
but when I failover logging ceases to work – in that nothing is logged – when I
failback logging works as before.  The mirroring has been configured
correctly (test has been done to verify this) so I think I can rule this out.
 
Other than the following entry (as per http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx)
included in my connection string is there something else required?
 
failover
partner=MyFailoverDatabaseServer
 
Is there anything else I should be considering?
 
Thanks in advance.
 
Colin
 
 
 
 
 

________________________________
 

Edinburgh Business School is a Charity Registered in Scotland, SC026900
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

RE: SQL 2005 Database Mirroring Support

Posted by "Gourlay, Colin" <cg...@ebs.hw.ac.uk>.
Hello.

When I turn on internal debugging I get nothing at all.

This is a web application (using Windows authentication) and the user has write permissions to the folder I created where I wanted the log4net debugging output be rendered to.


In case this is significant I  added the following to the web.config file: <add key="log4net.Internal.Debug" value="true"/>



And added the following to the logging.config file (the logging information is held in a separate config file).  I use ConfigureAndWatch() to pick up the changes but just to be sure that it picked up the additions I restarted the web site in IIS.



    <system.diagnostics>

        <trace autoflush="true">

            <listeners>

                <add

                    name="textWriterTraceListener"

                    type="System.Diagnostics.TextWriterTraceListener"

                    initializeData="C:\tmp\log4net.txt" />

            </listeners>

        </trace>

    </system.diagnostics>





Any thoughts?



Colin








From: Ron Grabowski [mailto:rongrabowski@yahoo.com]
Sent: 11 November 2008 22:12
To: Log4NET User
Subject: Re: SQL 2005 Database Mirroring Support
Importance: Low

What does log4net report as the error when you turn on internal debugging?

________________________________
From: "Gourlay, Colin" <cg...@ebs.hw.ac.uk>
To: Log4NET User <lo...@logging.apache.org>
Sent: Tuesday, November 11, 2008 11:07:33 AM
Subject: RE: SQL 2005 Database Mirroring Support
Hi Dag.

Thanks for your response.  Unfortunately I am still no further forward on this despite following your suggestion.  I have included further information if this helps.  Suggestions/Advice are very much appreciated.

Both servers are fully service packed and are running with

Log4Net  v1.2.10
SQL 2005
.Net 3.5

My log4net configuration is as follows:

<log4net>
                                <root>
                                                <level value="DEBUG" />
                                                <appender-ref ref="LogToSqlServer"/>
                                </root>

                                <appender name="LogToSqlServer" type="log4net.Appender.AdoNetAppender">

                                                <filter type="log4net.Filter.LoggerMatchFilter">
                                                                <loggerToMatch value="NHibernate" />
                                                                <acceptOnMatch value="false" />
                                                </filter>


                                                <bufferSize value="0"/>
                                                <!--<threshold value="DEBUG"/>-->
                                                <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                                                <connectionString value="data source=<SERVER-NAME-IS-HERE>;initial catalog=<LOGGING-DATABASE-IS-HERE>;integrated security=true;"/>
                                                <commandText value="EXEC <STORED-PROC-NAME-IS-HERE> @User, @Logger, @LoggingLevel, @Message"/>
                                                <parameter>
                                                                <parameterName value="@User"/>
                                                                <dbType value="String"/>
                                                                <size value="255"/>
                                                                <layout type="log4net.Layout.PatternLayout">
                                                                                <conversionPattern value="%identity"/>
                                                                </layout>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@Logger"/>
                                                                <dbType value="String"/>
                                                                <size value="255"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%logger"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@LoggingLevel"/>
                                                                <dbType value="String"/>
                                                                <size value="50"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%level"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@Message"/>
                                                                <dbType value="String"/>
                                                                <size value="4000"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%message"/>
                                                </parameter>
                                </appender>
                </log4net>

From: Dag Christensen [mailto:Dag.Christensen@vismaretail.no]
Sent: 06 November 2008 13:06
To: Log4NET User
Subject: RE: SQL 2005 Database Mirroring Support
Importance: Low

Should be handled transparently if you're using SqlClient or native client and a correct connection string. I think log4net uses OLE DB by default, you might want to try changing this to SqlClient.

If it still doesn't work, try setting your appender's ReconnectOnError to true.

It would also be helpful if you posted the versions you're using (log4net, SQL server 2005 service pack?, .NET framework version and service pack?) and your log4net configuration.

Best wishes,
Dag


From: Gourlay, Colin [mailto:cg1@ebs.hw.ac.uk]
Sent: Thursday, November 06, 2008 12:59 PM
To: Log4NET User
Subject: SQL 2005 Database Mirroring Support

Does log4net support the database mirroring feature in SQL 2005?

It logs quite happily when logging to our primary database but when I failover logging ceases to work - in that nothing is logged - when I failback logging works as before.  The mirroring has been configured correctly (test has been done to verify this) so I think I can rule this out.

Other than the following entry (as per http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx) included in my connection string is there something else required?

failover partner=MyFailoverDatabaseServer

Is there anything else I should be considering?

Thanks in advance.

Colin





________________________________

Edinburgh Business School is a Charity Registered in Scotland, SC026900
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

RE: SQL 2005 Database Mirroring Support

Posted by "Gourlay, Colin" <cg...@ebs.hw.ac.uk>.
Hello again Dag.

Updated my config file as per your suggestion and now the application is not logging to the primary database or the failover database.

I tried to enable log4net's internal debugging but no file with information is being created (permissions to create the file had been granted to the user running the application).

I am running SP1 on SQL Server 2005.

Any thoughts?

Cheers

Colin

From: Dag Christensen [mailto:Dag.Christensen@vismaretail.no]
Sent: 12 November 2008 07:46
To: Log4NET User
Subject: RE: SQL 2005 Database Mirroring Support
Importance: Low

You're using .NET framework 1.x's SqlClient which doesn't support transparent database mirroring. The correct type name is:
System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(you can verify this name using typeof(SqlConnection).AssemblyQualifiedName))

You should specify a failover partner in your connection string in case the principal server is offline when you make the initial connection:
Data Source=<SQLA>;Failover Partner=<SQLB>;Initial Catalog=<..>;Integrated Security=True

I also assume you're running Sql Server 2005 SP1 or later? SQL server 2005 pre-SP1 doesn't officially support mirroring in production use.

Best wishes,
Dag


From: Ron Grabowski [mailto:rongrabowski@yahoo.com]
Sent: Tuesday, November 11, 2008 11:12 PM
To: Log4NET User
Subject: Re: SQL 2005 Database Mirroring Support

What does log4net report as the error when you turn on internal debugging?

________________________________
From: "Gourlay, Colin" <cg...@ebs.hw.ac.uk>
To: Log4NET User <lo...@logging.apache.org>
Sent: Tuesday, November 11, 2008 11:07:33 AM
Subject: RE: SQL 2005 Database Mirroring Support
Hi Dag.

Thanks for your response.  Unfortunately I am still no further forward on this despite following your suggestion.  I have included further information if this helps.  Suggestions/Advice are very much appreciated.

Both servers are fully service packed and are running with

Log4Net  v1.2.10
SQL 2005
.Net 3.5

My log4net configuration is as follows:

<log4net>
                                <root>
                                                <level value="DEBUG" />
                                                <appender-ref ref="LogToSqlServer"/>
                                </root>

                                <appender name="LogToSqlServer" type="log4net.Appender.AdoNetAppender">

                                                <filter type="log4net.Filter.LoggerMatchFilter">
                                                                <loggerToMatch value="NHibernate" />
                                                                <acceptOnMatch value="false" />
                                                </filter>


                                                <bufferSize value="0"/>
                                                <!--<threshold value="DEBUG"/>-->
                                                <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                                                <connectionString value="data source=<SERVER-NAME-IS-HERE>;initial catalog=<LOGGING-DATABASE-IS-HERE>;integrated security=true;"/>
                                                <commandText value="EXEC <STORED-PROC-NAME-IS-HERE> @User, @Logger, @LoggingLevel, @Message"/>
                                                <parameter>
                                                                <parameterName value="@User"/>
                                                                <dbType value="String"/>
                                                                <size value="255"/>
                                                                <layout type="log4net.Layout.PatternLayout">
                                                                                <conversionPattern value="%identity"/>
                                                                </layout>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@Logger"/>
                                                                <dbType value="String"/>
                                                                <size value="255"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%logger"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@LoggingLevel"/>
                                                                <dbType value="String"/>
                                                                <size value="50"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%level"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@Message"/>
                                                                <dbType value="String"/>
                                                                <size value="4000"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%message"/>
                                                </parameter>
                                </appender>
                </log4net>

From: Dag Christensen [mailto:Dag.Christensen@vismaretail.no]
Sent: 06 November 2008 13:06
To: Log4NET User
Subject: RE: SQL 2005 Database Mirroring Support
Importance: Low

Should be handled transparently if you're using SqlClient or native client and a correct connection string. I think log4net uses OLE DB by default, you might want to try changing this to SqlClient.

If it still doesn't work, try setting your appender's ReconnectOnError to true.

It would also be helpful if you posted the versions you're using (log4net, SQL server 2005 service pack?, .NET framework version and service pack?) and your log4net configuration.

Best wishes,
Dag


From: Gourlay, Colin [mailto:cg1@ebs.hw.ac.uk]
Sent: Thursday, November 06, 2008 12:59 PM
To: Log4NET User
Subject: SQL 2005 Database Mirroring Support

Does log4net support the database mirroring feature in SQL 2005?

It logs quite happily when logging to our primary database but when I failover logging ceases to work - in that nothing is logged - when I failback logging works as before.  The mirroring has been configured correctly (test has been done to verify this) so I think I can rule this out.

Other than the following entry (as per http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx) included in my connection string is there something else required?

failover partner=MyFailoverDatabaseServer

Is there anything else I should be considering?

Thanks in advance.

Colin





________________________________

Edinburgh Business School is a Charity Registered in Scotland, SC026900
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

RE: SQL 2005 Database Mirroring Support

Posted by Dag Christensen <Da...@vismaretail.no>.
You're using .NET framework 1.x's SqlClient which doesn't support
transparent database mirroring. The correct type name is:

System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089

(you can verify this name using
typeof(SqlConnection).AssemblyQualifiedName))

 

You should specify a failover partner in your connection string in case
the principal server is offline when you make the initial connection:

Data Source=<SQLA>;Failover Partner=<SQLB>;Initial
Catalog=<..>;Integrated Security=True

 

I also assume you're running Sql Server 2005 SP1 or later? SQL server
2005 pre-SP1 doesn't officially support mirroring in production use.

 

Best wishes,

Dag

 

 

From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Tuesday, November 11, 2008 11:12 PM
To: Log4NET User
Subject: Re: SQL 2005 Database Mirroring Support

 

What does log4net report as the error when you turn on internal
debugging?

 

________________________________

From: "Gourlay, Colin" <cg...@ebs.hw.ac.uk>
To: Log4NET User <lo...@logging.apache.org>
Sent: Tuesday, November 11, 2008 11:07:33 AM
Subject: RE: SQL 2005 Database Mirroring Support

Hi Dag.

 

Thanks for your response.  Unfortunately I am still no further forward
on this despite following your suggestion.  I have included further
information if this helps.  Suggestions/Advice are very much
appreciated.

 

Both servers are fully service packed and are running with 

 

Log4Net  v1.2.10

SQL 2005

.Net 3.5 

 

My log4net configuration is as follows:

 

<log4net>

                                <root>

                                                <level value="DEBUG" />

                                                <appender-ref
ref="LogToSqlServer"/>

                                </root>

 

                                <appender name="LogToSqlServer"
type="log4net.Appender.AdoNetAppender">

                                                

                                                <filter
type="log4net.Filter.LoggerMatchFilter">

 
<loggerToMatch value="NHibernate" />

 
<acceptOnMatch value="false" />

                                                </filter>

 

 

                                                <bufferSize value="0"/>

                                                <!--<threshold
value="DEBUG"/>-->

                                                <connectionType
value="System.Data.SqlClient.SqlConnection, System.Data,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

                                                <connectionString
value="data source=<SERVER-NAME-IS-HERE>;initial
catalog=<LOGGING-DATABASE-IS-HERE>;integrated security=true;"/>

                                                <commandText value="EXEC
<STORED-PROC-NAME-IS-HERE> @User, @Logger, @LoggingLevel, @Message"/>

                                                <parameter>

 
<parameterName value="@User"/>

                                                                <dbType
value="String"/>

                                                                <size
value="255"/>

                                                                <layout
type="log4net.Layout.PatternLayout">

 
<conversionPattern value="%identity"/>

 
</layout>

                                                </parameter>

                                                <parameter>

 
<parameterName value="@Logger"/>

                                                                <dbType
value="String"/>

                                                                <size
value="255"/>

                                                                <layout
type="log4net.Layout.PatternLayout" value="%logger"/>

                                                </parameter>

                                                <parameter>

 
<parameterName value="@LoggingLevel"/>

                                                                <dbType
value="String"/>

                                                                <size
value="50"/>

                                                                <layout
type="log4net.Layout.PatternLayout" value="%level"/>

                                                </parameter>

                                                <parameter>

 
<parameterName value="@Message"/>

                                                                <dbType
value="String"/>

                                                                <size
value="4000"/>

                                                                <layout
type="log4net.Layout.PatternLayout" value="%message"/>

                                                </parameter>

                                </appender>

                </log4net>

 

From: Dag Christensen [mailto:Dag.Christensen@vismaretail.no] 
Sent: 06 November 2008 13:06
To: Log4NET User
Subject: RE: SQL 2005 Database Mirroring Support
Importance: Low

 

Should be handled transparently if you're using SqlClient or native
client and a correct connection string. I think log4net uses OLE DB by
default, you might want to try changing this to SqlClient.

 

If it still doesn't work, try setting your appender's ReconnectOnError
to true.

 

It would also be helpful if you posted the versions you're using
(log4net, SQL server 2005 service pack?, .NET framework version and
service pack?) and your log4net configuration.

 

Best wishes,

Dag

 

 

From: Gourlay, Colin [mailto:cg1@ebs.hw.ac.uk] 
Sent: Thursday, November 06, 2008 12:59 PM
To: Log4NET User
Subject: SQL 2005 Database Mirroring Support

 

Does log4net support the database mirroring feature in SQL 2005? 

 

It logs quite happily when logging to our primary database but when I
failover logging ceases to work - in that nothing is logged - when I
failback logging works as before.  The mirroring has been configured
correctly (test has been done to verify this) so I think I can rule this
out.

 

Other than the following entry (as per
http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx)
included in my connection string is there something else required?

 

failover partner=MyFailoverDatabaseServer

 

Is there anything else I should be considering?

 

Thanks in advance.

 

Colin

 

 

 

 

 

________________________________


Edinburgh Business School is a Charity Registered in Scotland, SC026900

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft
Exchange.
For more information, connect to http://www.f-secure.com/

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

Re: SQL 2005 Database Mirroring Support

Posted by Ron Grabowski <ro...@yahoo.com>.
What does log4net report as the error when you turn on internal debugging?




________________________________
From: "Gourlay, Colin" <cg...@ebs.hw.ac.uk>
To: Log4NET User <lo...@logging.apache.org>
Sent: Tuesday, November 11, 2008 11:07:33 AM
Subject: RE: SQL 2005 Database Mirroring Support

 
Hi Dag.
 
Thanks for your response. 
Unfortunately I am still no further forward on this despite following your
suggestion.  I have included further information if this helps. 
Suggestions/Advice are very much appreciated.
 
Both servers are fully service
packed and are running with 
 
Log4Net  v1.2.10
SQL 2005
.Net 3.5 
 
My log4net configuration is as
follows:
 
<log4net>
                                <root>
                                                <level
value="DEBUG" />
                                                <appender-ref
ref="LogToSqlServer"/>
                                </root>
 
                                <appender
name="LogToSqlServer"
type="log4net.Appender.AdoNetAppender">
                                                
                                                <filter
type="log4net.Filter.LoggerMatchFilter">
                                                                <loggerToMatch
value="NHibernate" />
                                                                <acceptOnMatch
value="false" />
                                                </filter>
 
 
                                                <bufferSize
value="0"/>
                                                <!--<threshold
value="DEBUG"/>-->
                                                <connectionType
value="System.Data.SqlClient.SqlConnection, System.Data,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                                                <connectionString
value="data source=<SERVER-NAME-IS-HERE>;initial catalog=<LOGGING-DATABASE-IS-HERE>;integrated
security=true;"/>
                                                <commandText
value="EXEC <STORED-PROC-NAME-IS-HERE> @User, @Logger,
@LoggingLevel, @Message"/>
                                                <parameter>
                                                                <parameterName
value="@User"/>
                                                                <dbType
value="String"/>
                                                                <size
value="255"/>
                                                                <layout
type="log4net.Layout.PatternLayout">
                                                                                <conversionPattern
value="%identity"/>
                                                                </layout>
                                                </parameter>
                                                <parameter>
                                                                <parameterName
value="@Logger"/>
                                                                <dbType
value="String"/>
                                                                <size
value="255"/>
                                                                <layout
type="log4net.Layout.PatternLayout" value="%logger"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName
value="@LoggingLevel"/>
                                                                <dbType
value="String"/>
                                                                <size
value="50"/>
                                                                <layout
type="log4net.Layout.PatternLayout" value="%level"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName
value="@Message"/>
                                                                <dbType
value="String"/>
                                                                <size
value="4000"/>
                                                                <layout
type="log4net.Layout.PatternLayout" value="%message"/>
                                                </parameter>
                                </appender>
                </log4net>
 
From:Dag Christensen
[mailto:Dag.Christensen@vismaretail.no] 
Sent: 06 November 2008 13:06
To: Log4NET User
Subject: RE: SQL 2005 Database Mirroring Support
Importance: Low
 
Should be handled transparently if you’re using SqlClient
or native client and a correct connection string. I think log4net uses OLE DB
by default, you might want to try changing this to SqlClient.
 
If it still doesn’t work, try setting your
appender’s ReconnectOnError to true.
 
It would also be helpful if you posted the versions you’re
using (log4net, SQL server 2005 service pack?, .NET framework version and
service pack?) and your log4net configuration.
 
Best wishes,
Dag
 
 
From:Gourlay, Colin
[mailto:cg1@ebs.hw.ac.uk] 
Sent: Thursday, November 06, 2008 12:59 PM
To: Log4NET User
Subject: SQL 2005 Database Mirroring Support
 
Does log4net support the database mirroring feature in SQL
2005? 
 
It logs quite happily when logging to our primary database
but when I failover logging ceases to work – in that nothing is logged
– when I failback logging works as before.  The mirroring has been
configured correctly (test has been done to verify this) so I think I can rule
this out.
 
Other than the following entry (as per http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx)
included in my connection string is there something else required?
 
failover
partner=MyFailoverDatabaseServer
 
Is there anything else I should be considering?
 
Thanks in advance.
 
Colin
 
 
 
 
 

________________________________
 

Edinburgh Business School is a Charity Registered in Scotland, SC026900
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

RE: SQL 2005 Database Mirroring Support

Posted by "Gourlay, Colin" <cg...@ebs.hw.ac.uk>.
Hi Dag.

Thanks for your response.  Unfortunately I am still no further forward on this despite following your suggestion.  I have included further information if this helps.  Suggestions/Advice are very much appreciated.

Both servers are fully service packed and are running with

Log4Net  v1.2.10
SQL 2005
.Net 3.5

My log4net configuration is as follows:

<log4net>
                                <root>
                                                <level value="DEBUG" />
                                                <appender-ref ref="LogToSqlServer"/>
                                </root>

                                <appender name="LogToSqlServer" type="log4net.Appender.AdoNetAppender">

                                                <filter type="log4net.Filter.LoggerMatchFilter">
                                                                <loggerToMatch value="NHibernate" />
                                                                <acceptOnMatch value="false" />
                                                </filter>


                                                <bufferSize value="0"/>
                                                <!--<threshold value="DEBUG"/>-->
                                                <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                                                <connectionString value="data source=<SERVER-NAME-IS-HERE>;initial catalog=<LOGGING-DATABASE-IS-HERE>;integrated security=true;"/>
                                                <commandText value="EXEC <STORED-PROC-NAME-IS-HERE> @User, @Logger, @LoggingLevel, @Message"/>
                                                <parameter>
                                                                <parameterName value="@User"/>
                                                                <dbType value="String"/>
                                                                <size value="255"/>
                                                                <layout type="log4net.Layout.PatternLayout">
                                                                                <conversionPattern value="%identity"/>
                                                                </layout>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@Logger"/>
                                                                <dbType value="String"/>
                                                                <size value="255"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%logger"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@LoggingLevel"/>
                                                                <dbType value="String"/>
                                                                <size value="50"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%level"/>
                                                </parameter>
                                                <parameter>
                                                                <parameterName value="@Message"/>
                                                                <dbType value="String"/>
                                                                <size value="4000"/>
                                                                <layout type="log4net.Layout.PatternLayout" value="%message"/>
                                                </parameter>
                                </appender>
                </log4net>

From: Dag Christensen [mailto:Dag.Christensen@vismaretail.no]
Sent: 06 November 2008 13:06
To: Log4NET User
Subject: RE: SQL 2005 Database Mirroring Support
Importance: Low

Should be handled transparently if you're using SqlClient or native client and a correct connection string. I think log4net uses OLE DB by default, you might want to try changing this to SqlClient.

If it still doesn't work, try setting your appender's ReconnectOnError to true.

It would also be helpful if you posted the versions you're using (log4net, SQL server 2005 service pack?, .NET framework version and service pack?) and your log4net configuration.

Best wishes,
Dag


From: Gourlay, Colin [mailto:cg1@ebs.hw.ac.uk]
Sent: Thursday, November 06, 2008 12:59 PM
To: Log4NET User
Subject: SQL 2005 Database Mirroring Support

Does log4net support the database mirroring feature in SQL 2005?

It logs quite happily when logging to our primary database but when I failover logging ceases to work - in that nothing is logged - when I failback logging works as before.  The mirroring has been configured correctly (test has been done to verify this) so I think I can rule this out.

Other than the following entry (as per http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx) included in my connection string is there something else required?

failover partner=MyFailoverDatabaseServer

Is there anything else I should be considering?

Thanks in advance.

Colin





________________________________

Edinburgh Business School is a Charity Registered in Scotland, SC026900
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

RE: SQL 2005 Database Mirroring Support

Posted by Dag Christensen <Da...@vismaretail.no>.
Should be handled transparently if you're using SqlClient or native
client and a correct connection string. I think log4net uses OLE DB by
default, you might want to try changing this to SqlClient.

 

If it still doesn't work, try setting your appender's ReconnectOnError
to true.

 

It would also be helpful if you posted the versions you're using
(log4net, SQL server 2005 service pack?, .NET framework version and
service pack?) and your log4net configuration.

 

Best wishes,

Dag

 

 

From: Gourlay, Colin [mailto:cg1@ebs.hw.ac.uk] 
Sent: Thursday, November 06, 2008 12:59 PM
To: Log4NET User
Subject: SQL 2005 Database Mirroring Support

 

Does log4net support the database mirroring feature in SQL 2005? 

 

It logs quite happily when logging to our primary database but when I
failover logging ceases to work - in that nothing is logged - when I
failback logging works as before.  The mirroring has been configured
correctly (test has been done to verify this) so I think I can rule this
out.

 

Other than the following entry (as per
http://blogs.technet.com/johnbaker/archive/2005/10/06/412126.aspx)
included in my connection string is there something else required?

 

failover partner=MyFailoverDatabaseServer

 

Is there anything else I should be considering?

 

Thanks in advance.

 

Colin

 

 

 

 

 

________________________________


Edinburgh Business School is a Charity Registered in Scotland, SC026900

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/