Assuming you are registering your plugins in a database, you have several options:
- Configure log4net programmatically. This can be done using the log4net API and can be controlled by the configuration object in crm.
Insert the log4net configuration file into the plug-in assembly and configure log4net from the stream (shown below in the base class of the plug-in, which other plug-ins that want to write the log can inherit from)
namespace TestPlugins { public abstract class BaseLoggingPlugin { protected static readonly ILog _log = LogManager.GetLogger(typeof(BaseLoggingPlugin)); static BaseLoggingPlugin() { using(var config = Assembly.GetExecutingAssembly().GetManifestResourceStream("TestPlugins.log4net.config")) { XmlConfigurator.Configure(config); } } } }
source share