02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CoreLogger Class<br />

Fig. 3-7 Categorized Messages in the Application Log File<br />

The CoreLogger, Error, Warn, and Info methods all support definitions that receive<br />

a message string or a message string and a category string. The Error method is further<br />

overloaded to receive an exception and output the exception message. The Debug<br />

method only receives a string.<br />

When the Error method with exception is used, the exception message will be appended<br />

to the message provided as the argument to the method. The code:<br />

try<br />

{<br />

int k = I / j;<br />

}<br />

catch (Exception exception)<br />

{<br />

CoreLogger.Error (“Error dividing values”, exception);<br />

}<br />

Results in the Error dividing values message in the log file followed by the exception<br />

message as in:<br />

2/15/2006 10:33:59 AM General [Hostname petrel.exe] Error dividing<br />

values<br />

System.DivideByZeroException: Attemted to divide by zero.<br />

at ...<br />

...<br />

...<br />

<strong>Schlumberger</strong> Private<br />

<strong>Ocean</strong> Core 3-43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!