Reputation: 3231
What is the best approach for sending whole files (log files etc) in a logging mechanism?
Ideally we would like to have a mechanism, not only to send some logging info (exception message, class and method etc) but also to transmit to our e-support system some log files (or any files in general) that would help. We want this mechanism as much parametrized as it can get for each application (specify the files or folders to send, specify how to send or when, on which error etc etc..) We also need to find a way to "attach" these files to our logging information in our DB system in the e-support platform, not just send them and then try to archive them manually.
My initial idea was to use a modified version of an SMTP appender and find a way to send the files (probably zipping them first)
I also thought of making an FTP (or SFTP) appender to transmit the files to an sftp folder in our esupport system.
Another idea is to have a windows service on the production machines and have an appender that would signal this service to collect and send certain files (so that all the hassle of collecting the files, zipping them and sending them, resides outside the application itsef in case the app crashes or something. We speak about both win and web apps)
I also think of modifying the existing webservice appender, adding some logic to the webservice itself so, when the appender sends logging info, the resposnce would signal the appender to also send some files in any way they can be sent.
So, what is the best approach for this requirement? Any ideas? Is there anything that I should be careful for?
Upvotes: 4
Views: 709
Reputation: 5398
Some questions: When do you want to send the logging information? Always or after an exception occured? On application close?
Depending on your answer, it might be easier to have a class which handles your requirements and just sends the files which are created by the currently configured log appenders. In that case I suggest to not create an own appender but a separate class but build something along those lines.
Upvotes: 1