The goal is to have our application specific event logs in a folder with the name of our company. So, Company/App1, Company/App2. I would prefer to accomplish this with configuration, or with very little code. I tried setting logName to "MyFolder/MyLog" to no avail.
Example of a folder in event viewer, reference the Microsoft folder
This is my current Appender configuration:
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="WARN" />
<levelMax value="FATAL" />
</filter>
<applicationName value="ExampleApp" />
<logName value="MyLog" />
<layout type="log4net.L开发者_运维问答ayout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
You can set the path directly in the configuration, where you specify the log name, just specify the full path. You must however make sure that whatever user your application is running under has write access to that folder. Permissions are usually the cause for problems like this.
精彩评论