<configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <log4net> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <!--Log path--> <param name="File" value="log/err/" /> <param name="Encoding" value="utf-8" /> <! -- Whether it is appending logs to the file -- > <param name="AppendToFile" value="true" /> <! --log retention days --> <param name="MaxSizeRollBackups" value="10" /> <! -- Whether the log file name is fixed --> <param name="StaticLogFileName" value="false" /> <! -- Log file name formatted as:2008-08-31.log --> <param name="DatePattern" value="yyyy-MM-dd"error.log"" /> <! -- Logs scroll by date--> <param name="RollingStyle" value="Date" /> <layout type="log4net.Layout.PatternLayout"> <!-- <param name="Header" value="[Header] " /> --> <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> <!-- <param name="Footer" value="%n [Footer] " /> --> <!-- <conversionPattern --> <!-- value="<HR COLOR=red>%n时间:%d [%t] <BR>%n级别:%-5p <BR>%n类:%c [%x] <BR>%n%m <BR>%n <HR Size=1>" /> --> </layout> <filter type="log4net.Filter.LevelRangeFilter"> <param name="LevelMax" value="Error" /> <param name="LevelMin" value="Error" /> </filter> </appender> <root> <!--(High) OFF > FATAL > ERROR > WARN > INFO > DEBUG > ALL (Low) --> <level value="all" /> <appender-ref ref="RollingLogFileAppender" /> </root> </log4net> </configuration>
Reading a file by multiple processes will cause the log file to be occupied, as follows:
it is being used by another process, so the process cannot access this file
This configuration item needs to be added in log4net.config
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
Similar Posts:
- [How to Solve] log4j: WARN Please initialize the log4j system properly
- log4j:WARN No appenders could be found for logger [How to Solve]
- [Solved] Failed to load class “org.slf4j.impl.StaticLoggerBinder
- [Solved] log4j:WARN No appenders could be found for logger
- A large number of ESC symbols appear in the log file of logback
- Log system reconstruction of unity3d
- Spring MVC: How to Solve Chinese garbled code Issue
- CMake: How to Complie Log4cplus
- Elasticsearch Startup Error: main ERROR Unable to locate appender “rolling_old” for logger config “root”
- [Solved] No connection string named ‘TestEntities’ could be found in the application config file