Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Bidding Directory   Improve your ranking, submit to directories   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 10-08-2006, 03:47 PM   #1 (permalink)
Contributing Member
 
Join Date: 05-02-04
Posts: 166
iTrader: 0 / 0%
thing2b is liked by many
Appending to logged PHP error messages

I log all error messages to a log file with the following code:
Code:
// Error logging ini_set( 'log_errors', 1 ); ini_set( 'display_errors', 0 ); ini_set( 'error_log', LOG_DIR . '/Log - PHP Errors.txt' ); ini_set('ignore_repeated_errors',0);
The problem with this is that the same PHP script is used for more than one site and it is hard to track does the source of the errors. Can anyone suggest a method of appending a string to each logged message so that extra information can be included into the log entry?

I am aware that I could use the following code to split it into a log file per site:

Code:
ini_set('error_log', LOG_DIR.'/'.$_SERVER['HTTP_HOST'].'/Log - PHP Errors.txt' );
but I would like to also append extra information such as the Referer, IP and some other variables to the message that will help me recreate the error conditions.
__________________
Webmaster of http://pickbrains.com/
thing2b is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 10-08-2006, 09:40 PM   #2 (permalink)
v7n Mentor
 
digiweb's Avatar
 
Join Date: 04-07-06
Location: Manchester, NH
Posts: 769
iTrader: 1 / 100%
digiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of lightdigiweb is a glorious beacon of light
Send a message via Yahoo to digiweb Send a message via Skype™ to digiweb
Not sure I follow you - have different instances of the script write to different logs, one per site. MUCH better than trying to parse concatenated information to figure out the same info but for different sites in the same log.
digiweb is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-09-2006, 11:26 AM   #3 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 310
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
I totally agree with Caroline. The following will write a different log file for each domain.

PHP Code:
ini_set'error_log'LOG_DIR '/Log - PHP Errors '.$_SERVER['SERVER_NAME'].' .txt' ); 
exam is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Appending to MultiDimensional Arrays bytech Coding Forum 5 03-03-2007 07:06 PM
What is the difference in these 2 error messages ? Linda in NY Forum Lobby 4 11-02-2006 05:47 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 09:43 PM.
© Copyright 2008 V7 Inc