Nous utilisons l'EnterpriseLibray pour enregistrer l'erreur dans notre application. Pour une raison quelconque, le fichier journal reste verrouillé jusqu'à ce que le service de pplication soit arrêté.Enterprise librairy RollingFlatFileTraceListener déverrouiller
Y at-il une option pour laisser le fichier déverrouillé lorsqu'il n'est pas utilisé? Mon but est de créer un processus externe (une sorte de chien de garde) qui copie et zippe le fichier journal .... mais il est verrouillé.
Une idée?
C'est ce que mon app.config ressemble:
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
<listeners>
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="Server.log" rollSizeKB="2024" footer="----------------------------------------" formatter="NovaLogFormatter" header="- NEW TRACE ----------------------------------------" rollFileExistsBehavior="Increment" maxArchivedFiles="20" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Timestamp: {timestamp(local)}{newline}
Message: {message}{newline}
Category: {category}{newline}
Severity: {severity}{newline}
Title: {title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
Extended Properties:{newline}{dictionary({key}{newline}{value}{newline})}" name="NovaLogFormatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="All" name="Data" />
<add switchValue="All" name="Security" />
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings" />
</specialSources>
</loggingConfiguration>
Merci beaucoup. Va probablement lire simplement le fichier et copier le contenu dans un autre fichier pour éviter le verrou .... semble trop simple, mais n'a pas d'événement penser à cette option. – michelqa