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 For all objects

Write a string to a log file

Syntax 2 For ErrorLogging objects


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.

Returns

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

NoteInverse of Log The inverse of the Log function is the Exp function.

Examples

Example 1

This statement returns 2.302585092:

Log(10)

Example 2

This statement returns –.693147. . . :

Log(0.5)

Example 3

Both these statements result in an error at runtime:

Log(0)

Log(-2)

Example 4

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

double a, b =  Log(200)

a = Exp(b)// a = 200

See also


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

Returns

None.

Usage

The ErrorLogging object provides the ability to write messages to the log file used by the object’s container, such as jaguar.log for EAServer.

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

Examples

Example 5

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

ErrorLogging el

this.GetContextService("ErrorLogging", el)

el.log("Write this string to log")

See also

GetContextService