How to create a log file for the website to monitor the logs like errors, warnings... without any thirdparty utility,Can we create our own..

i want the all the log actions running in the site to be displayed in the system and also to save in the memory location…
Can anyone give me the explanation about it…