|
Hi ravalia,
you must iterate Appenders to find your FileAppender, and
after change the file property.
vb sample code here :
-------------------------------------------
Module CustomLog
Private ReadOnly Log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType) Public Sub ChangeLogFile(ByVal
AppenderName As String, ByVal LogFile As
String)
Dim oLogHierarchy As log4net.Repository.Hierarchy.Hierarchy = log4net.LogManager.GetLoggerRepository Dim Appenders As
Appender.AppenderCollection = oLogHierarchy.Root.Appenders
For i As Integer
= 0 To Appenders.Count -
1
If Appenders(i).Name = AppenderName Then
If TypeOf Appenders(i) Is Appender.FileAppender
Then
If CType(Appenders(i), Appender.FileAppender).File <> String.Empty Then CType(Appenders(i), Appender.FileAppender).Close() CType(Appenders(i), Appender.FileAppender).File = LogFile CType(Appenders(i), Appender.FileAppender).ActivateOptions()
Exit For
End If
End
If
Next
End Sub
End Module
--------------------------------------------------
Regards
Frederic De : Ravalia, Ajay [mailto:[EMAIL PROTECTED] Envoyé : mercredi 13 juillet 2005 18:09 À : [email protected] Objet : RollingFileAppender filename param Hi,
I cant seem to find any info to help with my (simple) problem.
I want to start several instances of a single exe. 1) Each instance should start by logging to a general file eg. Batch.log 2) Once the instance has enough information (obtained via DB calls), it becomes a specialization. 3) From this point onwards it should start logging to a different log-file eg <job-name>.log
I have implemented step 1 within the exes config file (using FileAppender.MinimalLock) BUT I cannot get my code to switch logging to a different logfile with FileAppender.ExclusiveLock setting.
Please help!?!?!
Ajay Ravalia
The information transmitted is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of Brevan Howard Asset Management LLP, its members and affiliates. Brevan Howard Asset Management LLP is authorised and regulated by the Financial Services Authority. Registered Office: 42 Portman Road, Reading, Berkshire RG3O 1EA. Phone number 020 7022 6100. |
- RollingFileAppender filename param Ravalia, Ajay
- RE: RollingFileAppender filename param Frederic Pierrat
