473,245 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,245 software developers and data experts.

Information which could help to reproduce the exception

QC
Hi Friends,
I have one Application running on Client PC, i coded to store all
Debug, Info, and Trace related information in Log file. This log file
helps me to analyze the exception if any generated in my Application.
Related to exception, i only stores information passed Exception (or
related exception type class) class (ToString(), Message property).
After analyzed and corrected so many exceptions using Logs in last 3
year, I am realizing that I should have sometime which will give me
more detail information e.g. what was the value of all input
parameters of the method where exception generated, or lot more
information which could help me to reproduce the exception at my
development station. I really don’t know what exactly it could be but
I am sure about one thing that it should be helpful to reproduce the
error.

I was thinking upon one that store more detail in log file but in this
case the performance will effect.

I just created this Discussion to get the view from all of you, and
all available different ways.
Jun 27 '08 #1
4 1375
On Jun 11, 11:30*am, QC <AKhandelwal.in...@gmail.comwrote:
Hi Friends,
* * *I have one Application running on Client PC, i coded to store all
Debug, Info, and Trace related information in Log file. This log file
helps me to analyze the exception if any generated in my Application.
Related to exception, i only stores information passed Exception (or
related exception type class) class (ToString(), Message property).
After analyzed and corrected so many exceptions using Logs in last 3
year, I am realizing that I should have sometime which will give me
more detail information e.g. what was the value of all input
parameters of the method where exception generated, or lot more
information which could help me to reproduce the exception at my
development station. I really don’t know what exactly it could be but
I am sure about one thing that it should be helpful to reproduce the
error.

I was thinking upon one that store more detail in log file but in this
case the performance will effect.

I just created this Discussion to get the view from all of you, and
all available different ways.

I think you can use Log4Net, which can be configured to log the
information like datetime of the error, error levels, and even to the
level which method / class / line of code generated the error. Only
constraint is that you have to put log statements explicitly and
generously.

-Cnu
Jun 27 '08 #2
QC
On Jun 11, 11:45*am, Duggi <DuggiSrinivasa...@gmail.comwrote:
On Jun 11, 11:30*am, QC <AKhandelwal.in...@gmail.comwrote:


Hi Friends,
* * *I have one Application running on Client PC, i coded to storeall
Debug, Info, and Trace related information in Log file. This log file
helps me to analyze the exception if any generated in my Application.
Related to exception, i only stores information passed Exception (or
related exception type class) class (ToString(), Message property).
After analyzed and corrected so many exceptions using Logs in last 3
year, I am realizing that I should have sometime which will give me
more detail information e.g. what was the value of all input
parameters of the method where exception generated, or lot more
information which could help me to reproduce the exception at my
development station. I really don’t know what exactly it could be but
I am sure about one thing that it should be helpful to reproduce the
error.
I was thinking upon one that store more detail in log file but in this
case the performance will effect.
I just created this Discussion to get the view from all of you, and
all available different ways.

I think you can use Log4Net, which can be configured to log the
information like datetime of the error, error levels, and even to the
level which method / class / line of code generated the error. Only
constraint is that you have to put log statements explicitly and
generously.

-Cnu- Hide quoted text -

- Show quoted text -
Thanks for your view...
Yes, but as per my knowledge, these all information can be found in
Exception Class as well, right?
also, log4net stores those information which passed by application.

Jun 27 '08 #3
QC
On Jun 11, 11:53*am, QC <AKhandelwal.in...@gmail.comwrote:
On Jun 11, 11:45*am, Duggi <DuggiSrinivasa...@gmail.comwrote:


On Jun 11, 11:30*am, QC <AKhandelwal.in...@gmail.comwrote:
Hi Friends,
* * *I have one Application running on Client PC, i coded to store all
Debug, Info, and Trace related information in Log file. This log file
helps me to analyze the exception if any generated in my Application.
Related to exception, i only stores information passed Exception (or
related exception type class) class (ToString(), Message property).
After analyzed and corrected so many exceptions using Logs in last 3
year, I am realizing that I should have sometime which will give me
more detail information e.g. what was the value of all input
parameters of the method where exception generated, or lot more
information which could help me to reproduce the exception at my
development station. I really don’t know what exactly it could be but
I am sure about one thing that it should be helpful to reproduce the
error.
I was thinking upon one that store more detail in log file but in this
case the performance will effect.
I just created this Discussion to get the view from all of you, and
all available different ways.
I think you can use Log4Net, which can be configured to log the
information like datetime of the error, error levels, and even to the
level which method / class / line of code generated the error. Only
constraint is that you have to put log statements explicitly and
generously.
-Cnu- Hide quoted text -
- Show quoted text -

Thanks for your view...
Yes, but as per my knowledge, these all information can be found in
Exception Class as well, right?
also, log4net stores those information which passed by application.- Hide quoted text -

- Show quoted text -
Is there also any way to get/store the detail information (each
Variable value, passed parameter value, result of any method,
calculation) of last 10 or 6 methods? In short like when debugging we
can check the value of each object/ result to find out reason of
exception. In the same manner the information can be found somewhere,
please let me know if we have any way.
Jun 27 '08 #4
Hi QC,

If you want to know what gets sent to the method you will need to log that
specifically. You can, however, minimize the amount of code needed by
creating a common logging method that can take unlimited variations of input
by using the params keyword

public Form1()
{
InitializeComponent();

Method("Hello World");
}

private void Method(string message)
{
try
{
throw new InvalidDataException("Bye bye");
}
catch (Exception ex)
{
LogError(ex, message);
}
}

private void LogError(Exception ex, params object[] parameters)
{
StackFrame frame = new StackFrame(1);
MethodBase mb = frame.GetMethod();
string methodName = mb.Name;
ParameterInfo[] pis = mb.GetParameters();

StringBuilder sb = new StringBuilder();
sb.Append(mb.Name + "(");

foreach(object o in parameters)
sb.Append(o + ", ");

if (parameters.Length 0)
sb.Remove(sb.Length - 2, 2);

sb.Append(")");

MessageBox.Show(sb.ToString());
}

--
Happy Coding!
Morten Wennevik [C# MVP]
"QC" wrote:
On Jun 11, 11:45 am, Duggi <DuggiSrinivasa...@gmail.comwrote:
On Jun 11, 11:30 am, QC <AKhandelwal.in...@gmail.comwrote:


Hi Friends,
I have one Application running on Client PC, i coded to store all
Debug, Info, and Trace related information in Log file. This log file
helps me to analyze the exception if any generated in my Application.
Related to exception, i only stores information passed Exception (or
related exception type class) class (ToString(), Message property).
After analyzed and corrected so many exceptions using Logs in last 3
year, I am realizing that I should have sometime which will give me
more detail information e.g. what was the value of all input
parameters of the method where exception generated, or lot more
information which could help me to reproduce the exception at my
development station. I really don’t know what exactly it could be but
I am sure about one thing that it should be helpful to reproduce the
error.
I was thinking upon one that store more detail in log file but in this
case the performance will effect.
I just created this Discussion to get the view from all of you, and
all available different ways.
I think you can use Log4Net, which can be configured to log the
information like datetime of the error, error levels, and even to the
level which method / class / line of code generated the error. Only
constraint is that you have to put log statements explicitly and
generously.

-Cnu- Hide quoted text -

- Show quoted text -

Thanks for your view...
Yes, but as per my knowledge, these all information can be found in
Exception Class as well, right?
also, log4net stores those information which passed by application.

Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dawn | last post by:
Hi, I have written a bot-like program, which basically does the same thing over and over again, only using different parameters. Everything goes fine, until after an hour or three, the...
18
by: Atara | last post by:
In my apllication I use the following code: '-- My Code: Public Shared Function strDate2Date(ByVal strDate As String) As System.DateTime Dim isOk As Boolean = False If (strDate Is Nothing)...
1
by: Zytan | last post by:
I have a function that accepts an Exception, and writes out all of its information to a log. This function is called in many places where an exception is caught. In some places, I'd like to add...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.