昨天我在我的 VB.NET Web 项目中实现了 log4net,并且运行良好。但是今天有人更新了这个项目,它不再起作用了。我的 Assemblyinfo.vb:
<Assembly: log4net.Config.XmlConfigurator(ConfigFileExtension:="Log4net", Watch:=True)>
Log4net.config:
<logger additivity="false" name="Access">
<level value="INFO" />
<appender-ref ref="Accesos" />
</logger>
<appender name="GeneralAppender" type="log4net.Appender.RollingFileAppender">
<file value="D:\Logs\LOG3.log" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyyMMdd" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100K" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] - [%logger] %message%newline" />
</layout>
</appender>
<appender name="Access" type="log4net.Appender.RollingFileAppender">
<file value="D:\Logs\LOG2.log" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyyMMdd" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100K" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] - [%logger] %message%newline" />
</layout>
</appender>
</log4net>
</configuration>
在我的 aspx
import log4net
...
log4net.Config.XmlConfigurator.Configure()
Dim logger As ILog = Nothing
logger = LogManager.GetLogger("GeneralAppender")
logger.InfoFormat("test")
我希望你能帮帮我