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. 4 1379
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
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.
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.
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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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)...
|
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...
|
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....
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |