[ 
https://issues.apache.org/jira/browse/LOG4NET-152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595055#action_12595055
 ] 

Ron Grabowski commented on LOG4NET-152:
---------------------------------------

Instead of relying on people guessing what your error is, I suggest you read 
the faq on how to enable internal debug messages so you can see what log4net 
says the problem is:

 How do I enable log4net internal debugging?
 http://logging.apache.org/log4net/release/faq.html

This is essentially what log4net is doing in code:

Type connectionType = Type.GetType("System.Data.SqlClient.SqlConnection, 
System.Data, Version=1.2.10.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089");
using (connection)
{
    connection.ConnectionString = 
"server=CJISDEVSQL01;database=EventLog;integrated security=true;"
    connection.Open();
    Assert.IsTrue(connection.State == ConnectionState.Open);
}

If that doesn't work then the AdoNetAppender won't work. My point about 
System.Data and the 1.2.10.0 version number is that there is no 1.2.10 version 
of System.Data. There is a 2.0.0.0 version:

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

That may or may not be the problem. I'm just guessing...you should enable 
internal debugging to learn what the real issue is.


 




> getting AsoNetAppender to work
> ------------------------------
>
>                 Key: LOG4NET-152
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-152
>             Project: Log4net
>          Issue Type: Improvement
>    Affects Versions: 1.2.10
>         Environment: windows asp.net c#
>            Reporter: m
>
> I've been trying to get log4net to work with asp.net 2.0 and a database 
> table. Here is the config file:
> <configSections>
> <section name="log4net" 
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
> </configSections>
> <log4net>
> <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
> <bufferSize value="1" />
> <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, 
> Version=1.2.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
> <connectionString value="server=CJISDEVSQL01;database=EventLog;integrated 
> security=true;" />
> <commandText value="exec LD80Event_CREATE @eventDate, @logLevel, @message, 
> @exception, @updateUserName" />
> <parameter>
> <parameterName value="@eventDate" />
> <dbType value="DateTime" />
> <layout type="log4net.Layout.RawTimeStampLayout" />
> </parameter>
> <parameter>
> <parameterName value="@logLevel" />
> <dbType value="String" />
> <size value="512" />
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%p" />
> </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="4000" />
> <layout type="log4net.Layout.ExceptionLayout" />
> </parameter>
> <parameter>
> <parameterName value="@updateUserName" />
> <dbType value="String" />
> <size value="50" />
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%p" />
> </layout>
> </parameter>
> </appender>
> <logger name="eventLog">
> <level value="ALL" />
> <appender-ref ref="AdoNetAppender" />
> </logger>
> <root>
> <level value="ALL" />
> <appender-ref ref="AdoNetAppender" />
> </root>
> </log4net>
> This is the line of code in Global.asax, Application_Start method:
> log4net.Config.XmlConfigurator.Configure();
> This is in the default page:
> private static readonly ILog eventLog = 
> LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
> The issue is all the properties are 'always' set to false when the 
> application is running and 'nothing' is ever written to the database. I have 
> been searching the web for a week now and I can not find any information that 
> has made a difference.
> Can you help with this problem?
> Thank you. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to