[ https://issues.apache.org/jira/browse/LOG4NET-357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dominik Psenner closed LOG4NET-357. ----------------------------------- Resolution: Invalid This doesn't seem to be a issue in log4net. Please ask questions in the dev mailing list: log4net-dev@logging.apache.org > Object Reference issue in changing the Log file name dynamically in threads > --------------------------------------------------------------------------- > > Key: LOG4NET-357 > URL: https://issues.apache.org/jira/browse/LOG4NET-357 > Project: Log4net > Issue Type: Bug > Reporter: Lakshmi > > Hai > Am creating a web application using Vb.Net for data processing. I am > implementing multi threading in processing functions. And also i used > log4net to log the function calls and steps. > My application requires multiple log file. So i used the following code to > change the log files dynamically. > ''' <summary> > ''' Function used to set the name for Log File > ''' </summary> > ''' <param name="Jobid"></param> > ''' <param name="jobtype"></param> > ''' <remarks></remarks> > Public Shared Sub SetLogFileName(ByVal Jobid As String, ByVal jobtype As > String) > Try > Dim logFileName As String > If (Jobid = 0) Then > logFileName = HttpContext.Current.Server.MapPath("~/Log/Setup_Log.txt") > Else > logFileName = HttpContext.Current.Server.MapPath("~/Log/Job_" & jobtype & "_" > & Jobid & ".txt") > End If > ChangeLogFileName("LogFileAppender", logFileName) > Catch ex As Exception > Throw ex > End Try > End Sub > ''' <summary> > ''' Function used to change the Log File Name > ''' </summary> > ''' <param name="AppenderName"></param> > ''' <param name="NewFilename">New name for the file</param> > ''' <returns>Returns a Bool Value</returns> > ''' > Public Shared Function ChangeLogFileName(ByVal AppenderName As String, ByVal > NewFilename As String) As Boolean > Try > XmlConfigurator.Configure() > Dim config As System.Configuration.Configuration = > System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/") > Dim RootRep As log4net.Repository.ILoggerRepository > RootRep = log4net.LogManager.GetRepository() > For Each iApp As log4net.Appender.IAppender In RootRep.GetAppenders() > If iApp.Name.CompareTo(AppenderName) = 0 AndAlso TypeOf iApp Is > log4net.Appender.RollingFileAppender Then > Dim fApp As log4net.Appender.RollingFileAppender = DirectCast(iApp, > log4net.Appender.RollingFileAppender) > fApp.File = NewFilename > fApp.ActivateOptions() > ' Appender found and name changed to NewFilename > Return True > End If > Next > ' appender not found > Return False > Catch ex As Exception > Throw ex > End Try > End Function > Whan am trying to change the log files in side thread it shows object > reference issue in following line clsLoggerCheck.SetLogFileName(JobID, > "Analysis") > what is the reson for object reference? how can I solve this issue? > Thanks -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira