Show / Hide Table of Contents

SetThreadContextValue Method

The key or name to use for this variable.

The current value to assign to this variable for this thread.

Sets a context variable for this thread.

Syntax

'Declaration

Public Shared Sub SetThreadContextValue( _
   ByVal _key_ As String, _
   ByVal _value_ As String _
) 
public static void SetThreadContextValue( 
   string _key_,
   string _value_
)

Parameters

key

The key or name to use for this variable.

value

The current value to assign to this variable for this thread.

Remarks

This variable allows you to add contextual information to your log entries (like the session ID or username of the currently logged-in user, etc. This applies only when using manual configuration of LogManager through configuration file. In the section of an appender, you can add the value of a thread context variable using the following syntax:

[%X{user} %X{session}]

You can then set two thread context values for key "user" and key "session" and they will print out in the log file.

For more information on configuring LogManager and defining appenders and layouts, please consult the user guide for your application.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server family

Reference

LogManager Class
LogManager Members

Back to top © 2022 Dovetail Software, Inc. - All rights reserved.
Clarify, Amdocs, and related products and names are copyright and trademark of Amdocs, Inc.
.NET, Visual Studio.NET, C#, Visual Basic and related products are trademark of Microsoft corporation.