log4net setup.

http://weblogs.asp.net/drnetjes/archive/2005/02/16/374780.aspx
I created a file called log4net.config.
--------------------------------------------
<?xml version="1.0"?>
<log4net>

  <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="Data Source=72.18.146.251,1533;Initial Catalog=omegalove;Persist Security Info=True;User ID=administrator;Password=...." providerName="System.Data.SqlClient" />
    <commandText value="INSERT INTO Log ([Date],[Level],[Logger],[User],[Message],[Exception]) VALUES (@log_date, @log_level, @logger, @user, @message, @exception)" />
    <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>
  </appender>

  <root>
    <level value="ALL" />
    <appender-ref ref="ADONetAppender" />
  </root>
</log4net>

1 st question is how to I reference this, I do not have an app_code directory.
2 nd is how can I test this.
I am confused by the article. Where the hell does this go?
public void LogError (string message, Exception e){  //get logger  ILog logger = LogManager.GetLogger("MyProject");    //set user to log4net context, so we can use %X{user} in the appenders  if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)    MDC.Set("user", HttpContext.Current.User.Identity.Name);   if (logger.IsErrorEnabled)    logger.Error(message, e); //now log error}
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Log]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
 BEGIN
CREATE TABLE [dbo].[Log] ( [Id] [int] IDENTITY (1, 1) NOT NULL, [Date] [datetime] NOT NULL, [Thread] [varchar] (255) NOT NULL, [Level] [varchar] (50) NOT NULL, [Logger] [varchar] (255) NOT NULL, [User] [varchar] (50) NULL, [Message] [varchar] (4000) NOT NULL, [Exception] [varchar] (2000) NULL)

Open in new window

omegaloveAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
omegaloveAuthor Commented:
I have this in my webconfig
 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
   
Now how do I setup the rest.
0
omegaloveAuthor Commented:
U just are giving me other approaches.
I would like to folloaw one standard,
0
omegaloveAuthor Commented:
k
0
CodeCruiserCommented:
> Where the hell does this go?
I guess that code is actually logging an error so it would go in a test page.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.