[jira] [Created] (LOG4NET-356) Log file are not wriitten in IIS7

2012-10-03 Thread Lakshmi (JIRA)
Lakshmi created LOG4NET-356:
---

 Summary: Log file are not wriitten in IIS7
 Key: LOG4NET-356
 URL: https://issues.apache.org/jira/browse/LOG4NET-356
 Project: Log4net
  Issue Type: Bug
Reporter: Lakshmi


Hai 

Am using log4net in my application. It works fine when i run via code. But when 
i host it in IIS7 the log files are not written.

What is the preferred account used to write to the log file directory, I tried 
network and network service and they did not work.  I tried iusr and that 
worked .  Which is the rght user account to work with logfiles?



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


[jira] [Created] (LOG4NET-357) Object Reference issue in changing the Log file name dynamically in threads

2012-10-03 Thread Lakshmi (JIRA)
Lakshmi created LOG4NET-357:
---

 Summary: 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=NewFilenameNew name for the file/param
''' returnsReturns 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


[jira] [Closed] (LOG4NET-356) Log file are not wriitten in IIS7

2012-10-03 Thread Dominik Psenner (JIRA)

 [ 
https://issues.apache.org/jira/browse/LOG4NET-356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dominik Psenner closed LOG4NET-356.
---

Resolution: Invalid

 Log file are not wriitten in IIS7
 -

 Key: LOG4NET-356
 URL: https://issues.apache.org/jira/browse/LOG4NET-356
 Project: Log4net
  Issue Type: Bug
Reporter: Lakshmi

 Hai 
 Am using log4net in my application. It works fine when i run via code. But 
 when i host it in IIS7 the log files are not written.
 What is the preferred account used to write to the log file directory, I 
 tried network and network service and they did not work.  I tried iusr and 
 that worked .  Which is the rght user account to work with logfiles?
 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


[jira] [Commented] (LOG4NET-356) Log file are not wriitten in IIS7

2012-10-03 Thread Dominik Psenner (JIRA)

[ 
https://issues.apache.org/jira/browse/LOG4NET-356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13468393#comment-13468393
 ] 

Dominik Psenner commented on LOG4NET-356:
-

Please ask questions in the users mailig list:

log4net-u...@logging.apache.org

 Log file are not wriitten in IIS7
 -

 Key: LOG4NET-356
 URL: https://issues.apache.org/jira/browse/LOG4NET-356
 Project: Log4net
  Issue Type: Bug
Reporter: Lakshmi

 Hai 
 Am using log4net in my application. It works fine when i run via code. But 
 when i host it in IIS7 the log files are not written.
 What is the preferred account used to write to the log file directory, I 
 tried network and network service and they did not work.  I tried iusr and 
 that worked .  Which is the rght user account to work with logfiles?
 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


[jira] [Closed] (LOG4NET-357) Object Reference issue in changing the Log file name dynamically in threads

2012-10-03 Thread Dominik Psenner (JIRA)

 [ 
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=NewFilenameNew name for the file/param
 ''' returnsReturns 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


Object Reference issue in changing the Log file name dynamically in threads

2012-10-03 Thread LakshmiThangaraj

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 
'''  
'''  
''' 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 
'''  
''' New name for the file 
''' returnsReturns 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

-- 
View this message in context: 
http://old.nabble.com/Object-Reference-issue-in-changing-the-Log-file-name-dynamically-in-threads-tp34508400p34508400.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.



Log file are not written in IIS7

2012-10-03 Thread LakshmiThangaraj

Hai 

Am using log4net in my application. It works fine when i run via code. But
when i host it in IIS7 the log files are not written. 

What is the preferred account used to write to the log file directory, I
tried network and network service and they did not work. I tried iusr and
that worked . Which is the rght user account to work with logfiles? 



Thanks

-- 
View this message in context: 
http://old.nabble.com/Log-file-are-not-written-in-IIS7-tp34508405p34508405.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.



RE: Log file are not written in IIS7

2012-10-03 Thread Dominik Psenner
Hi,

Am using log4net in my application. It works fine when i run via code. But
when i host it in IIS7 the log files are not written.

What is the preferred account used to write to the log file directory, I
tried network and network service and they did not work. I tried iusr and
that worked . Which is the rght user account to work with logfiles?

you could try to add this to your web.config:

system.web
identity impersonate=true/
/system.web

Cheers,
D.



RE: Object Reference issue in changing the Log file name dynamically in threads

2012-10-03 Thread Dominik Psenner
Hi,

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.

This is not going to work like this. The log4net-way is by defining
different appenders and filter the events there. Take this as a reference:

http://stackoverflow.com/questions/1612317/how-to-log-into-separate-files-pe
r-thread-with-log4net

Cheers,
D.



RE: Object Reference issue in changing the Log file name dynamically in threads

2012-10-03 Thread LakshmiThangaraj

This Works fine .. i am unable to use static appenders. Because i need to
change the name of the log file based on my processing function in my
application. Now my problem is am unable to use httpcontext or session
objects in threads.. Is there any way to do this?

Or else how can i creating log files dynamically?

Thanks



Dominik Psenner wrote:
 
 Hi,
 
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.
 
 This is not going to work like this. The log4net-way is by defining
 different appenders and filter the events there. Take this as a reference:
 
 http://stackoverflow.com/questions/1612317/how-to-log-into-separate-files-pe
 r-thread-with-log4net
 
 Cheers,
 D.
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Object-Reference-issue-in-changing-the-Log-file-name-dynamically-in-threads-tp34508400p34508605.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.



RE: Object Reference issue in changing the Log file name dynamically in threads

2012-10-03 Thread Dominik Psenner
This Works fine

Glad to hear that.

.. i am unable to use static appenders. Because i need to
change the name of the log file based on my processing function in my
application.

I can understand your problem. Unfortunately there is no easy way to change
the logfile dynamically at runtime. It all comes down to spawning and
disposal of file appenders at runtime.

Now my problem is am unable to use httpcontext or session
objects in threads.. Is there any way to do this?

Log4net does not imply rules on the scope of httpcontext or session
variables in threads. Thus this does not seem to be a log4net problem at
all. If I did not understand what you were saying here, please rephrase the
question.

Or else how can i creating log files dynamically?

In my opinion there's no safe way to do that. But someone elses mileage may
vary. A logfile is equivalent to a single (rolling) file appender and a
single (rolling) file appender can only append log events into exactly one
logfile. If you somehow manage to change that logfile at runtime it will
affect all other log events that should be written by this (rolling) file
appender too. Whether or not they come from another thread doesn't matter.

Generally said, the logic of dispatching messages should be placed into
event filters that are assigned to an appender. You could create a hierarchy
of remoting appenders that finally sink log events into a rolling file
appender, but in my humble opinion this construct is far to complex for a
mere logger. The worst logger you can have is one that does not log at all
because it was designed too complicated.

Therefore I encourage you to log events into a database. Then you can fetch
log events from that database with all different fancy logic you need.

Cheers,
D.