How to write code for a Logging Event?


Trivia Category: Science: Mathematics
Difficulty: Medium
The Pythagorean theorem states that the square of the hypotenuse is equal to the product of the squares of the other two sides.
True or False?

 
Thread Tools Search this Thread
# 8  
I'm approaching this as more of an Administrator so I apologise for that.

I have studied some C on and off but that is it. Are Logging Events and "Events as in OOP the same? Are those what are being sent to a log file? Interactions between OOP objects?
# 9  
An "event" isn't a thing the way, say, a variable is. It's a generic term. What it means in this context pretty much depends on who's asking it why. Is there a book you're following or something?
# 10  
Lets go back to your code of
Quote:
if(error)
. How would I know if an error occurred? How is an Error Determined?

Last edited by theKbStockpiler; 12-05-2011 at 08:54 PM..
# 11  
This is getting very philosophical. An error isn't a 'thing'. An error is when you tried to do something and couldn't. Is it trying to open a file? If it can't, that's an error. Is it trying to write data to a socket? If it can't, that's an error. It can also be when you find unexpected conditions, like a NULL pointer that ought to not be null. And so on.

What are you actually trying to do?
# 12  
Lets say I'm trying to write to a file and the operation of doing this fails. Wouldn't I have to write additional code to make sure every outcome of my code was successful ,make sure data was written to the said file? If an error is not checked the application will just go on running code. An error is only an error if it is defined as one, otherwise the CPU continues running the code with erroneous data.

An analogy would be checking a simple mathematical addition equation by subtracting one of the addends from the sum to see if the other addend was left. If this check is not made we are not aware of the error and computations using this faulty data continue.


This webpage gives my original post some structure http://wiki.webratio.com/index.php/Debugging_with_application's_logs

I got to this topic indirectly from ELF files so that won't help much. Let's say I'm writing an application and think it will be useful to have some log files to view so when it crashes I will have a clue of what to look at to solve the problems the application is experiencing.

Last edited by theKbStockpiler; 12-05-2011 at 09:58 PM..
# 13  
If you're not making sure every call is successful, how do you know any of them were? You should be checking everything anyway. If you're not in the habit of doing so, there's no time like the present.

You can also view some things from the outside with a system utility like strace.
# 14  
So is about one half of a applications code there just to make sure that the other one half actually worked? Smilie
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

6 More Discussions You Might Find Interesting

1. Linux

Syslog not logging successful logging while unlocking server's console

When unlocking a Linux server's console there's no event indicating successful logging Is there a way I can fix this ? I have the following in my rsyslog.conf auth.info /var/log/secure authpriv.info /var/log/secure (1 Reply)
Discussion started by: walterthered
1 Replies

2. Shell Programming and Scripting

Logging success event into file

Hi, I've the following code to log the errors any after the command is executed. # Ksh 88 Version log_path=/home/etc/fls/fls_log.log del_path=/home/etc/fls/to_day rm $del_path/* >> $log_path 2>&1 But I even want to log if the rm command is success without any error along with... (1 Reply)
Discussion started by: smile689
1 Replies

3. Shell Programming and Scripting

Event logging to file and display to console | tee command is not able to log all info.

My intention is to log the output to a file as well as it should be displayed on the console > I have used tee ( tee -a ${filename} ) command for this purpose. This is working as expected for first few outputs, after some event loggin nothing is gettting logged in to the file but It is displaying... (3 Replies)
Discussion started by: sanoop
3 Replies

4. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

5. UNIX for Dummies Questions & Answers

How does Unix write events into event log?

Hi to everyone. I'm new to this forum and also pretty new to Unix. I'm developing a cross-platform software and I need to register informational and error messages into the event log of the system. Under Windows, this is implemented so far, I need to implement it unded Unix by now. I do know that... (7 Replies)
Discussion started by: mariano_donati
7 Replies

6. Shell Programming and Scripting

need help to write perl code

I have 2 files , one is master file and another file i am genearting which contains Number of fails for all host & version. The first file is master file which contains 2 column, Test Case name and Product Name: daily/DB/attach/attach_redundancy.exp: YRS daily/DB/help/help.exp: ... (0 Replies)
Discussion started by: getdpg
0 Replies

Featured Tech Videos