Custom Logging Messages from an biztalk Orchestration into a log

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,



I am facing issue in logging to a file using Enterprise Library 3.1. Can
some let me know what is going wrong by looking into following scenarios?



Scenario-1:



Usually if we take BTSNSVc.exe.config file to define <configSections> and
<loggingConfiguration> sections,

in the user defined logger class we use the Logger class of
Microsoft.Practices.EnterpriseLibrary.Logging to write entries to log file.



public void LogMessageToFile(string message)

{

LogEntry logEntry = new LogEntry();

logEntry.Message = message;

logEntry.Categories.Add("FlatFile Category");

Logger.Write(logEntry);

}

In this scenario all messages are written to one log file and a new log file
will be created if it gets saturated.



Scenario-2:



But here we have to use application specific config file (xyz.config) for
defining <configSections> and <loggingConfiguration> sections instead of
BTSNSVc.exe.config as we are not supposed to touch BizTalk config file. So in
our logger class we have used LogWriter to write entries to log file.



public void LogMessageToFile(string message)

{

LogWriter writer = null;



//getting the path of the xyz.config file which is configured in
BTSNSVc.exe.config file

string configFileLocation =
System.Configuration.ConfigurationSettings.AppSettings["FDFBBDataServiceConfigFile"];



// reading the <configSections> and <loggingConfiguration> sections from
xyz.config

FileConfigurationSource source = new
FileConfigurationSource(configFileLocation);



LogWriterFactory factory = new LogWriterFactory(source);

writer = factory.Create();

LogEntry logEntry = new LogEntry();

logEntry.Message = string.Format(message);

logEntry.Categories.Add("FlatFile Category");

writer.Write(logEntry);

}

}



In this scenario first entry is going to log file while other entries, each
one is going to a new log file(this filename is prefixed with a GUID as shown
below).



LogFile.log

2baf2ae4-55d0-4921-b549-8dba63a146c4LogFile.log

d9f454cb-93e9-4465-83a4-215d542d6109LogFile.log



We also wanted this log to be generated on daily basis so tried
RollingFlatFileTraceListener and FlatFileListener.

Expected result is only one log file to be created in a day with all the log
entries for that day.



NOTE: <configSections> and <loggingConfiguration> sections are same in both
scenarios

Thanks,
Pradeep
.



Relevant Pages

  • Custom Logging Messages from an biztalk Orchestration into a log
    ... some let me know what is going wrong by looking into following scenarios? ... Microsoft.Practices.EnterpriseLibrary.Logging to write entries to log file. ... LogEntry logEntry = new LogEntry; ... BTSNSVc.exe.config as we are not supposed to touch BizTalk config file. ...
    (microsoft.public.biztalk.server)
  • Custom Logging Messages from an biztalk Orchestration into a log
    ... some let me know what is going wrong by looking into following scenarios? ... Microsoft.Practices.EnterpriseLibrary.Logging to write entries to log file. ... LogEntry logEntry = new LogEntry; ... BTSNSVc.exe.config as we are not supposed to touch BizTalk config file. ...
    (microsoft.public.biztalk.general)
  • Re: endless "sysquery: no addrs found for root"
    ... > When I try to start named with this config, the log file shows ... > for each one of the root name servers. ... > I'm able to make queries from this same system, ...
    (freebsd-questions)
  • Re: More beginner help needed
    ... >>Why are you searching, instead of telling? ... You are already looking at the config file, ... where it *says* what the log file is and what goes in it. ... You don't need to get a successfukl connection in ...
    (comp.os.linux.misc)
  • Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit Xen support
    ... i've saved the merged 2.6.26-rc8-tip-00241-gc6c8cb2-dirty tree into tip/tmp.x86.xen-64bit.Sun_Jun_29_10 and pushed it out, so you can test that exact version. ... I've noticed this seems to happen quite a lot: there's a disconnect between the log file and the config which is supposed to have built the kernel. ...
    (Linux-Kernel)