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.

PetrelLogger Class<br />

Fig. 5-6 InfoOutputWindow Message Example<br />

Log File Only Messages<br />

The PetrelLogger class inherits from CoreLogger which provides methods that write<br />

only to the log file. It is recommended that the CoreLogger methods be used if your<br />

code will be used by different product families. The CoreLogger methods are discussed<br />

in detail, see Volume 3, Petrel Customization, Chapter 2, “Creating and Visualizing Custom<br />

Domain Objects,” on page 2-125. (AW)<br />

The basic definitions in the API for writing messages to the log file are:<br />

using Slb.<strong>Ocean</strong>.Petrel;<br />

PetrelLogger.Info (“This is an info message.”);<br />

PetrelLogger.Warn (“This is a warning message.”);<br />

PetrelLogger.Error (“This is an error message.”);<br />

...<br />

catch (DivideByZeroException e)<br />

{<br />

// Error message with exception information added<br />

PetrelLogger.Error (“This is an error message with exception.”, e);<br />

}<br />

The messages defined above and written to the log file are formatted with a date stamp, a<br />

category, the host machine, and the application being run. The format of the message is<br />

determined by the formatters tag in the loggingconfiguration section of the<br />

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

Petrel Convenience Classes 5-245

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

Saved successfully!

Ooh no, something went wrong!