Multiple Logging Application Blocks?

Topics: Logging Application Block
Oct 28, 2008 at 6:39 PM
I would like to use the LAB v4.0 with my SharePoint projects but it appears to me that I can only have a single log.  I'm new to the LAB so I just might be missing something.  I'm very familiar with the DAAB and I'm used to having many connection strings which I can use.  But since my SharePoint webparts and apps use the same web.config, I'm unable to tell each application/webpart to use a different LAB. 

For example, with the DAAB, I can do this:

DatabaseFactory.CreateDatabase("name of database")

I would like to be able to do something like

Logger("name of app").Write("...");

Thank you very much.
Oct 29, 2008 at 9:58 AM
The Logger class is a static class so you don't really create an instance of it.  What do you need that for?
Oct 29, 2008 at 11:31 AM
It would be helpful because like I had mentioned, my webparts/apps that run in SharePoint use the same web.config file.  The enterprise configuration tool allows me to have only one LAB per web.config.  This means that it appears that all my webparts/apps will use the same LAB instead of their own LAB.  I would like each one webpart/app to have their own log file.  I  hope this makes sense.  It appears to me that the LAB was designed for a single web.config per web app; not the other way around.
Oct 29, 2008 at 1:49 PM
If you want to use several log files, you can simply use different tracelisteners and specify different filenames for each.  Under each category sources, you can add several TraceListener references as well and configure each to point to a TraceListener object you've added in the configuration file. The category of each message will tell which TraceListener will be used when logging.
Nov 10, 2008 at 6:54 PM
I am develping Sharepoint webparts and need to incorporate Enterprise Library Logging Application Block into it. I think my approach is going wrong somewhere. Please correct me.
This is what my approch is.

I made changes to web.config that is being used by sharepoint portal. and try to log error using "logEntry" but I am getting some error saying configuration not found.

Please let me know what i need to do.

I am new to Enterprise Library.


Nov 11, 2008 at 1:11 AM
Hi, kindly post here your configuration file and your sample code.

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.