|
EventLog or custom log (text or XML document on predefined place)?
I am preparing for 70-536 exam, and I am working on some home brew exception handling for personal project, and I was wandering which solution is better?
In company of my first employment text logs in bin folder were canon, at least for errors and warnings.
In company in which I work now, EventLog is used almost exclusively.
None of the programmers in both companies couldn't explain their opinions and preferences with good arguments, first were simplicity advocates and second are somewhat coding purists/exhibitionist.
Seers and Gandalfs with eons of experience I summon ye!
|
|
|
|
|
Hi,
logging everything to the EventLog isn't so good if you ask me. It should only be used if it is really system critical and is only appropriate for very few logs. Logging to a file is better. But it should be done in some user specific directory. Vista for example doesn't like it much if you change the programs folder.
Have a look at log4net[^]. With it you can "just log" in your application. The configuration file than controls which logs of what level in which class get logged to a file, the EventLog or some other destination. You can also easiliy change this behaviour once your application is deployed.
Robert
|
|
|
|
|
|
log4net
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
I use my own XML-based logging.
Some of us are old dogs and EventLog is a new trick.
If you get in the habit of using EventLog what will you do when you need to write a non-Windows app?
|
|
|
|
|
Hi all. I was wondering if there is a way to specify a desired resolution (e.g. one second) and receive update notifications at the precise moment the system's time changes at that resolution.
For example, I would like to set up a simple clock in a form that matches exactly the seconds tick of the system clock (DateTime.Now).
I realize I could set up a timer for say 1000 milliseconds, but there is the potential for this to be randomly offset from the actual system time by as much as half a second... and clearly worse if I want my resolution to be minutes.
Is there any built-in or clever way of doing this? The best I can come up with would just be to set a timer to fire at very small intervals (say 10ms) and just do the math myself, but I worry that this would be excessive (I don't like to have a timer fire that often).
Any thoughts? Is there any Win32 mechanism?
{o,o}.oO( Did somebody say MouseDown? )
|)””’)
-”-”-
|
|
|
|
|
There is no way you can achieve that on a standard PC; the Windows kernel is not a real-time
kernel, so at best it makes a good effort at doing everything that is required with an
acceptable delay. Have you noticed the number of processes and threads on a typical system?
They all try to get their share of the CPU cycles!
What you can do is install a periodic timer that ticks a few times in your required
period (say at 200 msec if you want 1 second); that way, if your process gets a sufficient
share of the CPU cycles, it will be able to see a new period has elapsed with an accuracy
of around 20%. You can improve on the numbers but:
- shorter ticks will increase the CPU load of your process;
- other processes that are running on a higher priority, as well as all interrupts (e.g.
network traffic) may temporarily shut off your process, in which case the actual timer tick
will be seen late.
Another thing you can try is increase the process or thread priority, but as soon as they
go "above normal" other interactive actions may suffer.
The best result can be obtained by writing a device driver, which could run at a "real-time
priority", that is above all interactive tasks. But that excludes the use of .NET, the
CLR and its managed languages.
BTW: if you are relying on standard .NET timer classes for good accuracy, you may want
to read my timers article.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: BTW: if you are relying on standard .NET timer classes for good accuracy, you may want
to read my timers article.
Interesting read. Thanks.
{o,o}.oO( Did somebody say MouseDown? )
|)””’)
-”-”-
|
|
|
|
|
I just want to make a software that needs some calculations and waveform plot in matlab...
I have written the required .m files and using the combuilder of matlab 7 to generate the com files to be used in VB .Net. but after compilation in VB .Net the generated stand alone exe file still needs the MATLAB RUNTIME LIBRARY. Is there any possible way to make it independent of The MATLAB And its Run time library....
Thank You.......
@rish
|
|
|
|
|
Atrish wrote: but after compilation in VB .Net the generated stand alone exe file still needs the MATLAB RUNTIME LIBRARY.
True. Your C# assembly requires calls to be routed to the MatLab library.
Atrish wrote: Is there any possible way to make it independent of The MATLAB And its Run time library....
I don't think so having a static binding of a third party library into our assembly giving one monolithic application.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Atrish wrote: Is there any possible way to make it independent of The MATLAB And its Run time library....
No. Static linking is not supported in the .NET compilers. You must install the MATLAB runtime library to get this to work.
|
|
|
|
|
I have a great trouble! My client app uses a IpcChannel-based server which registers my remote type. This server is started by my client. From time to time I have to restart the server and create new instance of my remote type. At the moments of such re-creations I have exceptions: "Can't write to IPC-port: port closing is pending". So, I have to use try-catch block and create new instances two times: 1st time -> exception (and closing of the port), 2nd time -> normal creation of new instance. Do anybody know what I have to do with it?
PS: sometimes I get an OutOfMemoryException at the creation moments of the remote type. What could be a reason of it?
|
|
|
|
|
Microsoft .NET Framework 3.0 Service Pack 1
This is a web installer,do you think that a full .net 3.0 sp1 redistributable will be released??.One you can download and distribute with your app.
_________________________
"When the superior man refrains from acting, his force is felt for a thousand li." Sun Tzu
|
|
|
|
|
The overview says
"Microsoft .NET Framework 3.0 Service Pack 1 provides cumulative roll-up updates for customer reported issues"
Hence I guess the WebInstaller is a kind of wrapper which is going to download all the individual updates that are required by your system.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
I have an application which runs in the background without a main window. It receives messages from other components and displays Forms to respond to certain messages, the issue I am having is that the Forms usually appear behind Windows Explorer windows, I have tried using SetWindowPos(), SetForegroundWindow() and ShowWindow() API calls to bring the window to the front without success. The only way I can make the window always come to the front is to set it to TOP_MOST which is not the desired effect.
I have tried the API calls in the Form_Load event as that seemed the most suitable place, maybe I should place them somewhere else? Any ideas would be very welcome.
|
|
|
|
|
I've had a heck of a time with this myself. If your problem is that the system will sometimes simply flash the task bar button instead of bringing the window to the front, I find that sometimes setting the form to invisible, then Show()ing it sometimes works, or if that doesn't, then minimize it and then Active(), restore it, etc.
There are a ridiculous number of methods that all seem to mean the same thing. My list so far is:
Show()
Focus()
Select()
Activate()
BringToFront()
SetForegroundWindow()
{o,o}.oO( Did somebody say MouseDown? )
|)””’)
-”-”-
|
|
|
|
|
Hi,
Anyone knows how to use login control and how to connect it with the SQl server 2005 and connect to the table within my application database. So it can match the values from the table I have already created in my database.
Rock Star
|
|
|
|
|
If you aren't using the standard MS tables, you need to create your own membership and role providers to map to your structure. Have a look for membership provider or role provider in google.
|
|
|
|
|
Can any one knows any open source or free library that convert the MS word document to PDF document.
Thanks
Atif Khan
|
|
|
|
|
|
I can't remember where I heard this - and sure as heck can't find any info on the interweb - but I remember someone once saying that it's not possible to run a 1.1 and 2.0 application at the same time. Is this true, or did I mis-hear/misunderstand?
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
Mis-hear, misunderstand I guess. You can run these together because they use DLLs appropriate for their version. What you can't do is code in a different version of Visual Studio, so you can't code in VS2005 for .NET 1.1. Now, there is a disclaimer here - this is not true for Visual Studio 2008 - it has multi targetting capabilities so you can code for .NET 2, .NET 3 and .NET 3.5 out of the same application.
|
|
|
|
|
Pete O`Hanlon wrote: Mis-hear, misunderstand I guess
I guess so too - and also a little knowledge, certainly in my case, is a dangerous thing
I think what they were on about is the mechanics of side-by-side execution and how 1.1 applications could break if the user only has .net framework 2.0 installed. Found this article on the MSDN which sort of explains it:
http://msdn2.microsoft.com/en-us/library/s80xxs7s.aspx[^]
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
On top of that, you cannot have multiple versions of the .NET CLR running in the same process at the same time. For example, if you have a component that requires .NET 2.0 to run, you cannot use it in a .NET 1.1 app.
|
|
|
|
|
Hi,
I wanna export .csv records to my SQL server. I tried doing it by splitting it with comma (",") but some of the columms have descriptive data with many commas in it. So in that scenario the split logic gets messed up completely. Any other way that I can export .CSV data to SQL server?
Thanx in advance
Regards,
Vipul Mehta
Regards,
Vipul Mehta
|
|
|
|