Step 1:-
public partial class QWebPartBase : System.Web.UI.WebControls.WebParts.WebPart
{
#region Private Variables and constant declaration
public static QLogger _log;
#endregion
public QWebPartBase()
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
_log = QLogger.Current ??
QLogger.GetLogger(AuthenticationHelper.GetLoggingIdentity());
_log.ApplicationID =
ApplicationSetting.GetStringValue(ApplicationSetting.ApplicationId);
_log.Debug("Entering webpart");
});
}
}
Step 2:-
Modified Web.config file to have the following entries
<configSections>
<section name="enterpriseLibrary.ConfigurationSource"
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection,
Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirepermission="false" />
</configSections>
..............
<enterpriseLibrary.ConfigurationSource selectedSource="File Configuration
Source">
<sources>
<add name="File Configuration Source"
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource,
Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
filePath="App_EntLib.config" />
</sources>
</enterpriseLibrary.ConfigurationSource>
.........
Step 3:-
public class QWebPart01 : QWebPartBase
{
…………….
……………
protected override void CreateChildControls()
{
base.CreateChildControls();
……….
QWebPartBase._log.Debug("Inside
CreateChildControls of QWebPart01");
}
}
Initially i tried to deploy to bin but due to permission errors we changed
plan and now deploying to GAC but still iam not able to write log to file
,getting FileIOPermission,I think GAC deployed dll is having full rights,but
still iam getting permission error,Please any one can help me where am i
missing,
Thanks in advance
Pradeep