473,832 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enterprise Library Logging Application Block

Hi,

Using the EnterpriseLibra ry 4.0, is it possible to Log the method
name in the log file.

I have it cofigured thus:
<loggingConfigu ration name="Logging Application Block"
tracingEnabled= "true"
defaultCategory ="General" logWarningsWhen NoCategoriesMat ch="true">
<listeners>
<add fileName="trace .log"
header="----------------------------------------"
footer="----------------------------------------" formatter=""

listenerDataTyp e="Microsoft.Pr actices.Enterpr iseLibrary.Logg ing.Configurati on.FlatFileTrac eListenerData,
Microsoft.Pract ices.Enterprise Library.Logging , Version=4.0.0.0 ,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
traceOutputOpti ons="Timestamp" filter="All"
type="Microsoft .Practices.Ente rpriseLibrary.L ogging.TraceLis teners.FlatFile TraceListener,
Microsoft.Pract ices.Enterprise Library.Logging , Version=4.0.0.0 ,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
name="FlatFile TraceListener" />
</listeners>
<formatters>
<add template="Times tamp: {timestamp}&#xD ;&#xA;Message :
{message}&#xD;& #xA;Category: {category}&#xD; &#xA;Priorit y:
{priority}&#xD; &#xA;EventId : {eventid}&#xD;& #xA;Severity:
{severity}&#xD; &#xA;Title:{tit le}&#xD;&#xA;Me thod:
{method}&#xD;&# xA;Machine: {machine}&#xD;& #xA;Application Domain:
{appDomain}&#xD ;&#xA;Process Id: {processId}&#xD ;&#xA;Process Name:
{processName}&# xD;&#xA;Win32 Thread Id:
{win32ThreadId} &#xD;&#xA;Threa d Name: {threadName}&#x D;&#xA;Extende d
Properties: {dictionary({ke y} - {value}&#xD;&#x A;)}"

type="Microsoft .Practices.Ente rpriseLibrary.L ogging.Formatte rs.TextFormatte r,
Microsoft.Pract ices.Enterprise Library.Logging , Version=4.0.0.0 ,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
name="Text Formatter" />
</formatters>
<categorySource s>
<add switchValue="Al l" name="General">
<listeners>
<add name="FlatFile TraceListener" />
</listeners>
</add>
</categorySources >
<specialSources >
<allEvents switchValue="Al l" name="All Events" />
<notProcessed switchValue="Al l" name="Unprocess ed Category" />
<errors switchValue="Al l" name="Logging Errors &amp; Warnings">
<listeners>
<add name="FlatFile TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfigur ation>

My Interface ios configured thus:

public interface IDomainEntity
{
[Tag("Log")]
string Validate();
}

I am using the Policy Injection App Block thus

IDomainEntity customer = PolicyInjection .Create<Custome r,
IDomainEntity>( "Arun", null);
string res = customer.Valida te();

I want to log the method name too (in his case Validate()) to the log
file. Currently my app spits out the following log file:
----------------------------------------
General Information: 0 : Timestamp: 10/3/2008 9:53:57 AM
Message:
Category: General
Priority: -1
EventId: 0
Severity: Information
Title:Call Logging
Machine: PSI-2503-ARUN
App Domain: PIABTest.vshost .exe
ProcessId: 60620
Process Name: E:\MyProjects\P IABTest\PIABTes t\bin\Debug
\PIABTest.vshos t.exe
Thread Name:
Win32 ThreadId:16656
Extended Properties:
Timestamp=12107 455156919
----------------------------------------
----------------------------------------
General Information: 0 : Timestamp: 10/3/2008 9:53:58 AM
Message:
Category: General
Priority: -1
EventId: 0
Severity: Information
Title:Call Logging
Machine: PSI-2503-ARUN
App Domain: PIABTest.vshost .exe
ProcessId: 60620
Process Name: E:\MyProjects\P IABTest\PIABTes t\bin\Debug
\PIABTest.vshos t.exe
Thread Name:
Win32 ThreadId:16656
Extended Properties:
Timestamp=12107 458102597
----------------------------------------

How do I include the method name too in each log entry?

thanks,

Arun
Oct 3 '08 #1
1 2624
I'm not sure if there is a kewyord for the method name to put in the
configuration, but I use Extended property in Exception handler and
that works fine see below...

catch (Exception ex)
{
SetMasterPagePr operty(AppConst ants.ErrorMessa ge,
ex.Message);
ex.Data.Add("Me thod Name: ", "btnInsert_Clic k()");
Boolean rethrow;
rethrow = ExceptionPolicy .HandleExceptio n(ex,
AppConstants.UI Policy);
}

Oct 3 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1233
by: Ahsan | last post by:
Exception Application Block creates a Exception GUID that gets saved in the sink e.g. application log. How do I show this to a user on the web, so the user can use it as a reference when calling in for support. Regards Ahsan
1
2855
by: Ollie Riches | last post by:
I have written a custom logging sink for the enterprise library logging application block (June 2005). I have been able to configure it as expected from the UI config tool (EntLibConfig.exe). I have built a console application to test it with and I am getting the following error message write to the default trace log when I attempt to use my custom logging sink. 'An error occurred while the Distributor was processing the message. ...
1
8201
by: Ollie Riches | last post by:
I am trying to use asynchronous logging using MSMQ and I have configured the properties as defined in the help (see below) I don't understand where the property 'MsmqPath' is in the app.config for MSMQDistrbutor.exe is it meant to be an aplication settings or an enterprise library setting in the app.config? I have tried creating an application setting value for it but it still fails to write to the logging destination? Also is this...
7
9339
by: amitos | last post by:
Hi! I consider using the Logging Application Block, Enterprise Library, Jan 2006 in a major project. To date, I've found that some of its features are not very well documented. One important thing is logging to a database. I tried configuring a database trace listener in the "Enterprise Library Configuration". There I'm stuck. Stored procedures? Which ones exactly? What parameters do they take? I'm pretty confused. It also seems it...
3
2604
by: Dick | last post by:
How do I integrating ASP.NET Tracing with the Enterprise Library Logging Application Block? I guess this should be possible and in a similar way to the way ASP.NET Tracing is integrated with System.Diagnostics Tracing as described in http://msdn2.microsoft.com/en-us/library/b0ectfxd(VS.80).aspx. But I would have thought this is something most ASP developers using the Logging Application Block would want to do and therefore I expected to...
1
3566
by: sreedharv | last post by:
Log4Net vs Enterprise Library - Logging Application Block Please list or point to the comparison. My requirements are: - 50 to 70 web servers - Track Machine name - Extract class / method name irrespective of the info type - debug, trace, exception and more - Incoming bad links
2
6937
by: Anup Daware | last post by:
Hi Group, Can somebody tell me where I can find the internals of Logging application block 2.0/3.0. I need answers for the questions like: What best practices have followed in the implementation of logging application block? Is buffered writing is supported by this block? Does it write synchronously or asynchronously to the specified destination?
0
1191
by: =?Utf-8?B?d2lsbGlhbQ==?= | last post by:
Hi, I want to cache some stable user information on client side for later use by VB clients, so I implement enterprise library cache application block in COM+ serviced component which is developed in C#. I can save and retrieve it in short time period. The issue is the data will be expired in a few minutes even if I set the expiration to datatime.maxvalue. Here is code: cacheManager.Add(key, val, CacheItemPriority.Normal, null, new...
0
1581
by: adeelansari | last post by:
Any one can send me the code sample of Cache Application Block of Enterprise Library using Database storage , i successfully used the NullBackingStore , Please send me some sort of idea or code so that i implement it, i searched lots of web but no-one use cache application block with DataBackingStore - caches items in a database . Any one can help me out ??????
0
9794
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10780
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10497
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3968
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.