Sound like this could work! I’ll give it a try. Thanks :)

 

 

From: Karim Bourouba [mailto:[email protected]] 
Sent: 17. august 2009 12:03
To: [email protected]
Subject: RE: Adding a new column

 

Ok, so you need to do two things. 

  

First you need to figure out what you want your schema to look like, I would
suggest having a field called CustID or something - you can choose. How you
want this field to behave is up to you, for instance do you want it to be
nullable? 

  

One you have done that, look into the snippet of code I mailed earlier. You
can capture custom properties with log4net, one of these can be the value
you wish to put in your DB. 

  

How does this sound to you?



  

  _____  

From: [email protected]
To: [email protected]
Subject: RE: Adding a new column
Date: Mon, 17 Aug 2009 11:46:56 +0200

I want to add a new column to the DB schema so that I can log customer IDs
as a separate colum.

 

The table currently looks like this:

 

Id        int        

Date    datetime          

Thread varchar(255)   

[Level]            varchar(50)     

Logger            varchar(255)   

Message          varchar(4000) 

Exception       varchar(2000) 

Context           varchar(255)   

 

I want to add a new column and modify log4net to write a specific value to
the new column for all new log messages.

 

Then I want to either overload the logging methods so I can manually specify
a customer ID as a parameter like this:

log.Info(customerId, ”This is a customer specific log message”,
someException);

 

Or maybe pick up the customer ID automatically based on a session variable
or something.

 

 

 

 

From: Karim Bourouba [mailto:[email protected]] 
Sent: 17. august 2009 11:38
To: [email protected]
Subject: RE: Adding a new column

 

Do you mean adda new column to be logged? If you do, then you can use
&property(MY CUSTOM PROPERTY HERE) in the config file. Complimented with
log4net.GlobalContext.Properties["taskname"] = _taskName; in your code to
capture your custom column name (assuming it is called "taskname". 

  

If you are talking about your DB, then thats something outwith log4net I
think.



  

  _____  

From: [email protected]
To: [email protected]
Subject: Adding a new column
Date: Mon, 17 Aug 2009 11:25:02 +0200

Hi,

 

I’m using ADONetAppender and now I want to add a separate column where I can
automatically log a customer ID for each log entry. How do I go about to
implement this? 

 

/Henning

 

 

 

  _____  

Windows Live Messenger: Happy 10-Year Anniversary—get free winks and
emoticons. Get Them Now <http://clk.atdmt.com/UKM/go/157562755/direct/01/> 

 

  _____  

Celebrate a decade of Messenger with free winks, emoticons, display pics,
and more. Get Them <http://clk.atdmt.com/UKM/go/157562755/direct/01/>  Now

Reply via email to