You have to create assembly and attach it to the document library u want. In the assemlbly u have to handle document library events( for eg if deletion operation is done) There is some predefined events like insert,delete..etc..i worked on this its working fine
List of events.
---------------
Cancel Check Out - Changes made to a checked-out document are undone.
Check In - A document is checked in to the library.
Check Out - A document is checked out from the library.
Copy - A document in the library is copied.
Delete - A document is deleted from the library.
Insert - A new document is saved to the library.
Move or Rename - A document is moved or renamed.
Update - An existing document or the value of a custom column in the library is edited.