Skip to main content

Posts

Showing posts from December, 2015

log4net file appender file location

In log4net, we can use the FileAppender to log information into text files. There are two ways to specify the file: 1. Specify the file name in absolutely path. For example: <log4net> <appender name = "FileAppender" type = "log4net.Appender.FileAppender" > <file value = "c:\logs\log-file.txt" /> <appendToFile value = "true" /> <lockingModel type = "log4net.Appender.FileAppender+MinimalLock" /> <layout type = "log4net.Layout.PatternLayout" > <conversionPattern value = "%date [%thread] %-5level %logger - %message%newline" /> </layout> </appender> </log4net> Obviously, the file will be created in c:\logs\log-file.txt 2. Specify the file name in relative path. For example: <log4net> <appender name = "FileAppender" type = "log4net.Appender.FileAppender" ...