The Type that you pass into LoggingEvent should be the Type of the class that 
is creating the LoggingEvent. Look at the usage of "declaringType" below:

// untested
public class TxLogImpl : LogImpl, ITxLog
{
 private readonly static Type declaringType = typeof(TxLogImpl); 

 private void LogTx( log4net.Core.Level level, String callerFQCN, String 
transactionID, StartTx startTime, object[] pParams)
{
 if (transactionID == null)
 {
  return;
 }
 if (callerFQCN != null)
 {
  FQCN = callerFQCN;
 }
 System.String txMessage = generateMessage(transactionID, startTime, pParams, 
level);
 LoggingEvent loggingEvent = new LoggingEvent(declaringType, Logger.Repository, 
Logger.Name, level, txMessage, null);
 loggingEvent.Properties["TransactionID"] = transactionID;
 loggingEvent.Properties["CallerFQCN"] = FQCN; // ???
 Logger.Log(loggingEvent);
} 
 
}


----- Original Message ----

From: "Budamala, Jayakumar [CCC-OT_IT]" <[EMAIL PROTECTED]>

To: Log4NET User <[email protected]>

Sent: Wednesday, February 14, 2007 3:17:21 PM

Subject: RE: Calling Configure serveral time



RE: Calling Configure serveral time           Hi Ron, 

  I need your help regarding the log4net wrapper I am using. 

  Basically I implemented TxLog impl and TxLog manager using sample from 
eventID extension. 

  That is          

  public class TxLogImpl : LogImpl,ITxLog  

And ITxLog inherits Ilog. 

  The problem I am facing is not getting caller location.  

  I prepare loggingevent constructor, with caller FQCN, like this 

          private void LogTx( log4net.Core.Level level, String callerFQCN, 
String transactionID, StartTx startTime, object[] pParams)

                  {  

                        if (transactionID == null)  

                        {  

                                return ;  

                        }  

                        if (callerFQCN != null)  

                        {  

                                FQCN = callerFQCN;  

                        } 

                          Type FQCNType = 
SystemInfo.GetTypeFromString(FQCN,false,false);  

                        System.String txMessage = 
generateMessage(transactionID, startTime, pParams, level);  

                        LoggingEvent loggingEvent = new LoggingEvent(FQCNType, 
Logger.Repository, Logger.Name, level, txMessage, null);

                          loggingEvent.Properties["TransactionID"] = 
transactionID;  

                        Logger.Log(loggingEvent);  

                } 

  And this entire TxLogImpl and TxLogManager is wrapped by my own interface 
called ITxLogger where I am passing my own object

  , where I have declared like this 

                  private static readonly ITxLog logTx = 
TxLogManager.GetLogger(Assembly.GetCallingAssembly(),"EITLogger.Category.TxLogImpl");

 

                                          //object [] objArray = 
txObj.toObjectArray();  

                                        object [] objArray = 
txObj.toObjectArrayValues();  

                                          

                                        switch(level.ToString())  

                                        {  

                                                case "INFO":  

                                                {  

                                                        
logTx.Info(transactionId,FQCN,startTime,objArray);  

                                                        //log.Info( 

                                                          break;  

                                        } 

  logTx.Info interanlly calls TxLogImpl Ilog method as shown above. 

  Now the problem is I am not able to line number , methodname, callers 
information etc.  

Loggingevent LocationInfo, constructor, frameindex is equal to Framecount, 
that’s why its not getting any callers info, when I debug.

  Could you kindly give me some suggestion please.  

  

 

  Thanks and regards,   

Jayakumar Budamala   

Citigroup Architecture &  Technology Engineering (CATE)  - EIT  

Citigroup Campus   

283, King George Rd   

Warren, NJ - 07059   

Tel : 908-563-3064 

 

  -----Original Message-----  

From: wang junwei [mailto:[EMAIL PROTECTED]   

Sent: Sunday, February 11, 2007 9:20 AM  

To: [email protected]  

Subject: Re: Calling Configure serveral time 

  Hi, Sergey. Sorry for the two days not available in the list.  

It seems that you have got what you want.  

Actually, If you check or uncheck you add-in from the Add-in Manager, It will 
cause th corresponding class instantialized or desstructed.It will call the 
log4net XmlConfigurator every time incuring perfermance issue.But it does work.

  Regards  

>From: Sergey <[EMAIL PROTECTED]>  

>Reply-To: "Log4NET User" <[email protected]>  

>To: [email protected]  

>Subject: Re: Calling Configure serveral time  

>Date: Thu, 8 Feb 2007 18:22:45 +0000 (UTC)  

>  

>Thank you all! That is what I was looking for.  

>  

>Sergey  

> 

  _________________________________________________________________  

与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn   

  







Reply via email to