A
arunairs
Hi,
Using the EnterpriseLibrary 4.0, is it possible to Log the method
name in the log file.
I have it cofigured thus:
<loggingConfiguration name="Logging Application Block"
tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add fileName="trace.log"
header="----------------------------------------"
footer="----------------------------------------" formatter=""
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" filter="All"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="FlatFile TraceListener" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message:
{message}
Category: {category}
Priority:
{priority}
EventId: {eventid}
Severity:
{severity}
Title:{title}
Method:
{method}
Machine: {machine}
Application Domain:
{appDomain}
Process Id: {processId}
Process Name:
{processName}
Win32 Thread Id:
{win32ThreadId}
Thread Name: {threadName}
Extended
Properties: {dictionary({key} - {value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="FlatFile TraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="FlatFile TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
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<Customer,
IDomainEntity>("Arun", null);
string res = customer.Validate();
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\PIABTest\PIABTest\bin\Debug
\PIABTest.vshost.exe
Thread Name:
Win32 ThreadId:16656
Extended Properties:
Timestamp=12107455156919
----------------------------------------
----------------------------------------
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\PIABTest\PIABTest\bin\Debug
\PIABTest.vshost.exe
Thread Name:
Win32 ThreadId:16656
Extended Properties:
Timestamp=12107458102597
----------------------------------------
How do I include the method name too in each log entry?
thanks,
Arun
Using the EnterpriseLibrary 4.0, is it possible to Log the method
name in the log file.
I have it cofigured thus:
<loggingConfiguration name="Logging Application Block"
tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add fileName="trace.log"
header="----------------------------------------"
footer="----------------------------------------" formatter=""
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" filter="All"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="FlatFile TraceListener" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message:
{message}
Category: {category}
Priority:
{priority}
EventId: {eventid}
Severity:
{severity}
Title:{title}
Method:
{method}
Machine: {machine}
Application Domain:
{appDomain}
Process Id: {processId}
Process Name:
{processName}
Win32 Thread Id:
{win32ThreadId}
Thread Name: {threadName}
Extended
Properties: {dictionary({key} - {value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="FlatFile TraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="FlatFile TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
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<Customer,
IDomainEntity>("Arun", null);
string res = customer.Validate();
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\PIABTest\PIABTest\bin\Debug
\PIABTest.vshost.exe
Thread Name:
Win32 ThreadId:16656
Extended Properties:
Timestamp=12107455156919
----------------------------------------
----------------------------------------
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\PIABTest\PIABTest\bin\Debug
\PIABTest.vshost.exe
Thread Name:
Win32 ThreadId:16656
Extended Properties:
Timestamp=12107458102597
----------------------------------------
How do I include the method name too in each log entry?
thanks,
Arun