How can I log the installation of packages in Ubuntu? I want to send a message to log every time after a package is installed, like, "Package Installed" with the name of package & it should do that after uninstalling too. Is this possible? I am logging all this in a file called "Local3.log".
Yes you can do it. (You can use /var/log/apt/history.log* files or the method below)
First you have to create a shell script named apt-get(as shown below)
Then you have to add it to your PATH variable. You can do it by adding it to the /etc/profile for example if your script is located in /home/ankur/ you have to add a line to /etc/profile like the line below. export PATH=/home/ankur/:$PATH
Now whenever you execute apt-get our script executes first
(This might not be the perfect script) apt-get
It appears that apt logs this data here:
This blog had this and more info on package logging: