Log

Returns the natural logarithm of a number. For an ErrorLogging object, this function can be used to write a string to the log file maintained by the object's container.

To

Use

Determine the natural logarithm of a number

Syntax 1

Write a string to a log file

Syntax 2


Syntax 1: For all objects

Description

Determines the natural logarithm of a number.

Syntax

Log ( n ) 

Argument

Description

n

The number for which you want the natural logarithm (base e). The value of n must be greater than 0.


Return value

Double.

Returns the natural logarithm of n. An execution error occurs if n is negative or zero. If n is null, Log returns null.

Inverse of Log

The inverse of the Log function is the Exp function.

Examples

This statement returns 2.302585092:

Log(10)

This statement returns -.693147. . .:

Log(0.5)

Both these statements result in an error at runtime:

Log(0)
Log(-2)

After the following statements execute, the value of a is 200:

double a, b =  Log(200)
a = Exp(b)// a = 200

See also

Exp

LogTen

Log method for DataWindows in the section called “Log” in DataWindow Reference.

Syntax 2: For ErrorLogging objects

Description

Writes a string to the log file maintained by the object's container.

Applies to

ErrorLogging objects

Syntax

errorlogobj.Log ( message )

Argument

Description

errorlogobj

Reference to the ErrorLogging service instance

message

The text string you want to write to the log


Return value

None.

Usage

The ErrorLogging object provides the ability to write messages to the log file used by the object's container.

Before you call the Log function, create an instance of the ErrorLogging service by calling the GetContextService function.

Examples

The following example shows how to write a string to the log for COM+:

ErrorLogging el
this.GetContextService("ErrorLogging", el)
el.log("Write this string to log")

See also

GetContextService