logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jordan JBO. Bouclet" <jbouc...@scotler.fr>
Subject RE: multi process settings
Date Fri, 23 Oct 2009 14:54:11 GMT
Yep, i did it, it works, but now i'v got an other problem, i can't use an appendFile with the
rolling on size or by date.

Here is what I've done : 

<appender name="FileAppender" type="log4net.Appender.FileAppender"> 

                                 <file value="E:\\Log\\ArlSQL_Log\\ArlSql.log" /> 

                                 <lockingModel type="log4net.Appender.FileAppender+MinimalLock"

                                 <layout type="log4net.Layout.PatternLayout" value="%d
[%t] %-5p %c - %m%n" /> 



But for example, <maximumFileSize value="1MB" /> isn't usable with a type="log4net.Appender.FileAppender">


De : Florin Daneliuc [mailto:florin.daneliuc@iquestint.com] 
Envoyé : vendredi 23 octobre 2009 15:26
À : Log4NET User
Objet : RE: multi process settings


I think you can also instruct the logger to try to acquire the lock of the file and release
it as soon as possible.

Anyway, for multiple process logging, a file is not the best way. Maiby an event log (windows)
or syslog (nix) or a network sink might work better.





From: Jordan JBO. Bouclet [mailto:jbouclet@scotler.fr] 
Sent: Friday, October 23, 2009 12:55 PM
To: log4net-user@logging.apache.org
Subject: RE: multi process settings



I have got a problem with the settings of log4net about multi access on a file.

My context : I'v got a dll wich log into a trace.log. That dll is used by 2 different programs.
When the first create the instance of log4net, the 2nd one can't write into the trace.log.

I can't find the right settings to do that. The best behavior would be to create a new file
with YYYYMMdd-HH_mm_ss when the instance can't write into the file.


For now, I did, following the config-exemple from the apache site : 




                       <level value="ALL" />

                       <appender-ref ref="FileAppender" />


               <appender name="FileAppender" type="log4net.Appender.RollingFileAppender">

                       <file value="E:\\Log\\Trace.log" />

                       <appendToFile value="True" />

                       <rollingStyle value="Date" />

                       <staticLogFileName value="false" />

                       <lockingModel type="log4net.Appender.FileAppender+MinimalLock "

                       <datePattern value="yyyyMMdd-HHmm" />

                       <maxSizeRollBackups value="-1" />

                       <layout type="log4net.Layout.PatternLayout">

                               <conversionPattern value="%date [%-5level] : %message%newline"






But I'm having an error with the 2nd instance wich is : System.TypeLoadException: Could not
load type [log4net.Appender.FileAppender+MinimalLock ]. Tried assembly [log4net, Version=,
Culture=neutral, PublicKeyToken=1b44e1d426115821] and all loaded assemblies.


Is there a solution to that ? 




View raw message