About LogWriter

Oct 28, 2009 at 6:13 PM

I want to use Log writer to write in the Textemplate. But I am using Policy Injection also ...When I do that It is creating two different file for log with different texttemplate...

IDataStorage dataStorage;

IUnityContainer container = new UnityContainer();

container.AddNewExtension<EnterpriseLibraryCoreExtension>();

container.AddNewExtension<LoggingBlockExtension>();

container.RegisterType<IDataStorage, TaskDataStorage>(new ContainerControlledLifetimeManager());

dataStorage=container.Resolve<IDataStorage>();

//dataStorage.Update();

IConfigurationSource configSource = ConfigurationSourceFactory.Create("File Configuration Source");

container.Configure(typeof(IConfigurationSource));

PolicyInjectionSettings settings = (PolicyInjectionSettings)

configSource.GetSection(PolicyInjectionSettings.SectionName);

if (settings != null)

{ settings.ConfigureContainer(container, configSource); }

dataStorage = PolicyInjection.Wrap<IDataStorage>(dataStorage);

dataStorage.Update(); /// I used LogWriter  COde is below

public void Update()

{

logWriter.Write(new LogEntry { Message = "Updated" });

//return false;

}

 

----both the policy injection and logWriter is not refereing to same log file...I get two defferent log file with  two different format.........

One is which I define using  ELIB configuration..one I guess is deault one...

Help me to add new LogEntry in TextTemplate while using PolicyInjection

Oct 29, 2009 at 6:29 AM

Hi,

I'm not sure what are you pertaining by the "TextTemplate", is it the log file that was being created? If it is, is your issue: having 2 different file prefixed with Guid in the file name?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com