using log4net through stored procedures in oracle
- by areeba
hi,
My objective is to log in oracle 10g using log4net through stored procedure,but this code isn't working, what am doing wrong???
here is the code which I implemented.
string logFilePath = AppDomain.CurrentDomain.BaseDirectory + "log4netconfig.xml";
FileInfo finfo = new FileInfo(logFilePath);
log4net.Config.XmlConfigurator.ConfigureAndWatch(finfo);
ILog logger = LogManager.GetLogger("Exception.Logging");
try
{
log4net.ThreadContext.Properties["INNER_EXCEPTION"] = exception.InnerException.ToString();
log4net.ThreadContext.Properties["INNER_EXCEPTION"] = string.Empty;
log4net.ThreadContext.Properties["STACK_TRACE"] = exception.StackTrace.ToString();
log4net.ThreadContext.Properties["STACK_TRACE"] = string.Empty;
log4net.ThreadContext.Properties["MESSAGE"] = ((H2hException)exception).Message;
log4net.ThreadContext.Properties["CODE"] = "err-1010";
log4net.ThreadContext.Properties["MODULE"] = "TP.CoE";
log4net.ThreadContext.Properties["COMPONENT"] = "Component";
log4net.ThreadContext.Properties["ADDITIONAL_MESSAGE"] = "msg";
logger.Debug("");
I am retrieving configuration for log4net from a xml file "log4netconfig.xml" which is as follows.
<parameter>
<parameterName value="@p_Error_Code" />
<dbType value="VARCHAR2" />
<size value="16" />
<!--<layout type="log4net.Layout.PatternLayout" value="%level" />-->
<conversionPattern value="%property{log4net:CODE}"/>
</parameter>
<parameter>
<parameterName value="@p_Error_Message" />
<dbType value="VARCHAR2" />
<size value="255" />
<!--<layout type="log4net.Layout.PatternLayout" value="%logger" />-->
<conversionPattern value="%property{log4net:MESSAGE}"/>
</parameter>
<parameter>
<parameterName value="@p_Inner_Exception" />
<dbType value="VARCHAR2" />
<size value="4000" />
<!--<layout type="log4net.Layout.PatternLayout" value="%thread" />-->
<conversionPattern value="%property{log4net:INNER_EXCEPTION}"/>
</parameter>
<parameter>
<parameterName value="@p_Module" />
<dbType value="VARCHAR2" />
<size value="225" />
<!--<layout type="log4net.Layout.PatternLayout" value="%message" />-->
<conversionPattern value="%property{log4net:MODULE}"/>
</parameter>
<parameter>
<parameterName value="@p_Component" />
<dbType value="VARCHAR2" />
<size value="225" />
<!--<layout type="log4net.Layout.ExceptionLayout" />-->
<conversionPattern value="%property{log4net:COMPONENT}"/>
</parameter>
<parameter>
<parameterName value="@p_Stack_Trace " />
<dbType value="VARCHAR2" />
<size value="4000" />
<!--<layout type="log4net.Layout.PatternLayout"/>-->
<conversionPattern value="%property{log4net:STACK_TRACE}"/>
</parameter>
<parameter>
<parameterName value=" @p_Additional_Message" />
<dbType value="VARCHAR2" />
<size value="4000" />
<!--<layout type="log4net.Layout.ExceptionLayout" />-->
<conversionPattern value="%property{log4net:ADDITIONAL_MESSAGE}"/>
</parameter>
</appender>
kindly give me your feedback and solutions.
Thanks in advance.