March 19, 2012

show message in log file with php

Question by JERC

I need to know how to show a message in the log in apache with php, I know that java has this instruction

System.out.println

and in tcl

 ns_log notice

but there are some equivalent in php?

Thanks!!!

Answer by Starx

Use error_log() function to set custom error messages

error_log("Oracle database not available!", 0);

Or you can save the errors to custom log file as

error_log("Oops, something went wrong!", 3, "/var/tmp/my-errors.log");

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!