0

I can't seem to find any examples for configuring EntLib5 logging application block via code.

I have it configured via a config file and its working great but i would love to create another listener via code for writing out a log file for display how my plugins were loaded, succesfully or not.

Anybody have any advice or working example for doing a listener in pure code?

Martin
  • 23,844
  • 55
  • 201
  • 327

2 Answers2

0

I have not yet looked at the Entlib 5 yet but in principle the Api should be the same as for Entlib 2.0. Here is an example how to configure it via code.

Alois Kraus
  • 13,229
  • 1
  • 38
  • 64
0

The new fluent configuration interface added in v5.0 gives you an elegant and easy to interpret way to programmatically configure EntLib. See an example here: http://msdn.microsoft.com/en-us/library/ff664363(PandP.50).aspx#fluent_api_logging

IntelliSense will help with the rest.

Grigori Melnik
  • 4,067
  • 2
  • 34
  • 40
  • If the application is already using a configuration file (as in this question) can fluent configuration also be used without losing the file based configuration? – Randy Levy May 05 '11 at 02:38
  • 1
    You can mix external config and programmatic config but only at the block level. So, if you have EHAB in config, and LAB programmatically, that would work. However, if you want to specify one tracelistener of the LAB in config and another one programmatically, only the programmatic configuration wins. Unless you decide to use 2 separate containers. – Grigori Melnik May 05 '11 at 15:57