How to check if the log directory is writable? #221
|
Hello, in order to configure the log file path, you need to configure log4net, and then the log file is read-only. So how to check if the log file is accessible? If the log file is not accessible, logging will be disabled. And if the log file is accessible, the log file will be locked by log4net, so it is not possible to check if the file is accessible anymore. What is the right solution to this problem? |
Replies: 3 comments 7 replies
|
@PatriceDargenton I don't understand your problem exactly. |
|
Logging with log4net is disabled in my app because users do not have write permissions for the log file configured in the log4net config. |
|
You want to know whether the user has the permission to create/append to the log file configured in the config file? |
This is possible, but you will need to create your own Appender class (derived from FileAppender) and override ActivateOptions().
Then change your config to use the new Appender class.
For your use case probably not the best option.