Reputation: 668
Basically, this is what I am trying to do. I am using Log4Net and rolling over the log files each day and appending the file name with the date.
I'd like to catch the event that begins the rolling over action so that I can perform another task right after the rollover finishes.
Specifically, I am trying to encrypt the file immediately after it rolls over.
Any help would be greatly appreciated. Thanks in advance!
Upvotes: 2
Views: 768
Reputation: 5422
If you're doing nothing but leaving the encrypted file on the server then I see a flaw in your setup. You will always have the current day's data sitting in plain text on your server. Since it is all just streams I bet it would be easy to inherit from the RollingFileAppender and replace its output stream with something wrapped in an encrypted stream.
Upvotes: 1
Reputation: 3432
You can always imploy a file watcher on a seperate thread for your log directory. When it sees a new file, encrypt the last one. I can't find any rollover event for log4net, but this should be pretty quick for your needs.
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
Upvotes: 0