Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Log Destination


karinha

Recommended Posts

Hi everybody,

 

apparently I am explicitly stupid, but i don't crab the logging concept; First of all I am not sure if I understand in how far this could be of any help to me and second I can't get the log destination set up right. I just created a folder 'journal' in my admin section and wanted to set the log destination like this: admin/journal/page_parse_time.log. When I set store page parse time on true, then it gives me the follwoing error message:

 

Warning: error_log(admin/journal/page_parse_time.log): failed to open stream: No such file or directory in /home20/eq34517/secure/catalog/admin/includes/classes/logger.php on line 49

Parse Time: 0.077s

 

I looked into line 49 of this document, but can't find anything that could possibly help me to solve my problem.

 

Can anybody please help me how to solve that problem? Or redirect me somewhere were i would fidn help? It is rather urgent, since I am about to launch the shop...

 

Thanks a lot in advance!!!!

 

Karinha

Link to comment
Share on other sites

  • 2 weeks later...

I still wasn't able to fix that problem. PLEASE HELP!!!!!!!!!!!!!!!! Or convince me, that I don't need the log, but I guess it can be helpful for troubleshooting, right?

Link to comment
Share on other sites

I still wasn't able to fix that problem. PLEASE HELP!!!!!!!!!!!!!!!! Or convince me, that I don't need the log, but I guess it can be helpful for troubleshooting, right?

 

Ok I will try to help you out here... What you could do is display the file it is searching for around line 49 of the file (catalog/admin/includes/classes/logger.php) to see if it's path is ok.

 

If that doesn't help could you please give 10 lines or so surrounding line 49 from the same file so I can look around if I can see where it expects the file to be!

 

Grtz,

 

Bloged

I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.

-- Stephen Hawking

Link to comment
Share on other sites

Thank you very much for your answer!

 

If you wanted me to search for this url online: I did and a blank page is coming up, at least no error message. I don't know yet though in how far this could help me though. Or did you mean, I should enter this address as my logging destination????

 

I don't need to create a file page_parse_time.log to put into the journal folder, or do I? I checked again, if my folder journal does really exist, and it does in both my folders: html/catalog/admin and secure/catalog/admin (I am on a shared ssl certificate).

 

Here is the file /home20/eq34517/secure/catalog/admin/includes/classes/logger.php

 

<?php

/*

$Id: logger.php,v 1.3 2003/06/20 16:23:08 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class logger {

var $timer_start, $timer_stop, $timer_total;

 

// class constructor

function logger() {

$this->timer_start();

}

 

function timer_start() {

if (defined("PAGE_PARSE_START_TIME")) {

$this->timer_start = PAGE_PARSE_START_TIME;

} else {

$this->timer_start = microtime();

}

}

 

function timer_stop($display = 'false') {

$this->timer_stop = microtime();

 

$time_start = explode(' ', $this->timer_start);

$time_end = explode(' ', $this->timer_stop);

 

$this->timer_total = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);

 

$this->write(getenv('REQUEST_URI'), $this->timer_total . 's');

 

if ($display == 'true') {

return $this->timer_display();

}

}

 

function timer_display() {

return '<span class="smallText">Parse Time: ' . $this->timer_total . 's</span>';

}

 

function write($message, $type) {

error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' [' . $type . '] ' . $message . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);

}

}

?>

 

Thanks again for your help! I had already lost hope to receive an answer...

Link to comment
Share on other sites

Sorry for knocking again, but can anybody help??? anymore info needed?

Not sure if this will be of much help... but check if you do have admin/journal/page_parse_time.log file at the correct location and check the file permissions. The location/path of the file should match the location in database configurations table(Log Destination).... probably this variable should also be accessible through admin panel.

Link to comment
Share on other sites

Sorry for knocking again, but can anybody help??? anymore info needed?

 

Sorry for the delayed answer:

 

This function is the one that writes the log to a file defined in the variable STORE_PAGE_PARSE_TIME_LOG:

function write($message, $type) {
 error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' [' . $type . '] ' . $message . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

 

If you could echo that define:

function write($message, $type) {
 echo __FILE__ . ':' . __LINE__ . '<br />' . STORE_PAGE_PARSE_TIME_LOG . '<br /><br />';
 error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' [' . $type . '] ' . $message . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

 

That should display something like:

/home20/eq34517/secure/catalog/admin/includes/classes/logger.php:49

/home20/eq34517/secure/admin/journal/page_parse_time.log

 

The first line is the line that called it with after the : the line it was called

The second line display's the file it is looking for... Check if that file exists and that apache has the rights to alter this file.

 

Grtz,

 

Arjan Gelderblom

I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.

-- Stephen Hawking

Link to comment
Share on other sites

Dear Arjan Gelderblom,

 

I did what you told me to do. I still receive the same error message like before. >_< The file page_parse_time exists in the admin/journal folder and has rights on 777. Why does it still tell me, that there is no such file or directory??? Apparently it is looking for the right file, right?

 

Here is the echo plus error message:

 

/home20/eq34517/secure/catalog/admin/includes/classes/logger.php:49

admin/journal/page_parse_time.log

 

 

Warning: error_log(admin/journal/page_parse_time.log): failed to open stream: No such file or directory in /home20/eq34517/secure/catalog/admin/includes/classes/logger.php on line 50

Parse Time: 0.035s

 

Thanks a lot for trying to help me with this. :blush: If I can't fix it soon I'm afraid I'll leave the logging on false....

 

Have a good day,

 

Karin

Link to comment
Share on other sites

Dear Arjan Gelderblom,

 

I did what you told me to do. I still receive the same error message like before. >_< The file page_parse_time exists in the admin/journal folder and has rights on 777. Why does it still tell me, that there is no such file or directory??? Apparently it is looking for the right file, right?

 

Here is the echo plus error message:

 

/home20/eq34517/secure/catalog/admin/includes/classes/logger.php:49

admin/journal/page_parse_time.log

Warning: error_log(admin/journal/page_parse_time.log): failed to open stream: No such file or directory in /home20/eq34517/secure/catalog/admin/includes/classes/logger.php on line 50

Parse Time: 0.035s

 

Thanks a lot for trying to help me with this. :blush: If I can't fix it soon I'm afraid I'll leave the logging on false....

 

Have a good day,

 

Karin

 

:thumbsup: Don't give up... this could possibly learn you alot.

 

If I can see it right now it loks for the file in the directory:

/home20/eq34517/secure/catalog/admin/includes/classes/admin/journal/page_parse_time.log

 

Try for debugging this code in the file:

catalog/admin/includes/classes/logger.php

function write($message, $type) {
 error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' [' . $type . '] ' . $message . "\n", 3, '/home20/eq34517/secure/catalog/admin/journal/page_parse_time.log');
}

 

If that works the define isn't defined correctly that means the problem lies somewhere else!

 

Grtz,

 

Arjan Gelderblom

I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.

-- Stephen Hawking

Link to comment
Share on other sites

Wow, now I don't have any error message anymore. :thumbsup: So that was it? Or why do you say: 'If that works the define isn't defined correctly that means the problem lies somewhere else!'? Apparently the define wasn't working correctly, but can I not live with that, since it is defined now???

 

Where do you know that from?: 'If I can see it right now it loks for the file in the directory:

/home20/eq34517/secure/catalog/admin/includes/classes/admin/journal/page_parse_time.log'. Maybe it makes me smarter for the next time. I admit I am not a php superstar yet....but it's also the first time I work with it...

 

Thousand thanks for your help!!!!! :rolleyes:

 

Karin

Link to comment
Share on other sites

Wow, now I don't have any error message anymore. :thumbsup: So that was it? Or why do you say: 'If that works the define isn't defined correctly that means the problem lies somewhere else!'? Apparently the define wasn't working correctly, but can I not live with that, since it is defined now???

 

Where do you know that from?: 'If I can see it right now it loks for the file in the directory:

/home20/eq34517/secure/catalog/admin/includes/classes/admin/journal/page_parse_time.log'. Maybe it makes me smarter for the next time. I admit I am not a php superstar yet....but it's also the first time I work with it...

 

Thousand thanks for your help!!!!! :rolleyes:

 

Karin

 

PHP start from the directory the page is located in in thise case the file /home20/eq34517/secure/catalog/admin/includes/classes/logger.php is located in /home20/eq34517/secure/catalog/admin/includes/classes/. So admin/journal/page_parse_time.log start from there and thus will look for the file /home20/eq34517/secure/catalog/admin/includes/classes/admin/journal/page_parse_time.log. Therefore the define isn't correctly because it doesn't take in account that it has to give a full path to the function! If you still have questions about this keep asking! Learning is the main purpose of this board!

 

The code I gave is not really a great solution... If you would want to change the location of the parse log you'll have to delve into the code. Better is it to change it back to:

function write($message, $type) {
 error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' [' . $type . '] ' . $message . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

 

And (from memory) look in the file admin/includes/filenames.php. And search for something like:

define('STORE_PAGE_PARSE_TIME_LOG', ****);

 

Now if I'm correctly you should change it into (where *** is the original code):

define('STORE_PAGE_PARSE_TIME_LOG', DIR_FS_ROOT . ****);

 

If you have troubles post the original define in the file and I'll correct it myself ( :blush: )!

 

Grtz,

 

Arjan Gelderblom

I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.

-- Stephen Hawking

Link to comment
Share on other sites

PHP start from the directory the page is located in in thise case the file /home20/eq34517/secure/catalog/admin/includes/classes/logger.php is located in /home20/eq34517/secure/catalog/admin/includes/classes/. So admin/journal/page_parse_time.log start from there and thus will look for the file /home20/eq34517/secure/catalog/admin/includes/classes/admin/journal/page_parse_time.log. Therefore the define isn't correctly because it doesn't take in account that it has to give a full path to the function! If you still have questions about this keep asking! Learning is the main purpose of this board!Thanks, but I don't really crab it. Is it not logical that it shows the admin/includes/classes/logger.php, since that is the location the logger.php file is in? How would I know then, that it is searching the file in admin/includes/journal folder? Would it would like this then: home20/eq34517/secure/catalog/admin/journal?

 

The code I gave is not really a great solution... If you would want to change the location of the parse log you'll have to delve into the code. Better is it to change it back to:

function write($message, $type) {
 error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' [' . $type . '] ' . $message . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

 

And (from memory) look in the file admin/includes/filenames.php. And search for something like:

define('STORE_PAGE_PARSE_TIME_LOG', ****);

Sorry, I don't have any definition of the STORE_PAGE_PARSE_TIME in this file. Maybe that's the problem? Should I add a definition there? Or could this definition be in another file?

 

Now if I'm correctly you should change it into (where *** is the original code):

define('STORE_PAGE_PARSE_TIME_LOG', DIR_FS_ROOT . ****);

 

If you have troubles post the original define in the file and I'll correct it myself ( :blush: )!

 

Grtz,

 

Arjan Gelderblom

 

Thanks again!

Karin

Link to comment
Share on other sites

Thanks, but I don't really crab it. Is it not logical that it shows the admin/includes/classes/logger.php, since that is the location the logger.php file is in? How would I know then, that it is searching the file in admin/includes/journal folder? Would it would like this then: home20/eq34517/secure/catalog/admin/journal?

 

Ok let's try it again! You know the difference between relative and absolute paths I presume. In Linux (the OS of most hosting companies) any directory starting with a slash (/) is absolute. If it is a relative path you have to think of it like this: it will look for the file starting at the location your at.

 

In your case /home20/eq34517/secure/catalog/admin/includes/classes/logger.php is located in the absolute directory /home20/eq34517/secure/catalog/admin/includes/classes/ (you probably won't see the first part of the directory because the hosting company will hide this for you! Now if you are in your directory and start looking for admin/includes/classes/logger.php you have to think of it as if you would cd into that directory. So you are in /home20/eq34517/secure/catalog/admin/includes/classes/ and give the command cd admin/journal/page_parse_time.log. So it will add this to the already existing directory and comes to the new path /home20/eq34517/secure/catalog/admin/includes/classes/admin/journal/page_parse_time.log!

 

Sorry, I don't have any definition of the STORE_PAGE_PARSE_TIME in this file. Maybe that's the problem? Should I add a definition there? Or could this definition be in another file?

 

It isn't the problem, I don't have a osC2.2 shop here, I'm currently working at a osC3 shop so I'm guessing paths at the moment :blush: ! So it is a other file where it is defined. It could be located in the catalog/includes/filenames.php directory :mellow: !

 

Grtz,

 

Arjan Gelderblom

I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.

-- Stephen Hawking

Link to comment
Share on other sites

Aha I guess I still have to learn a lot about this echo concept. :blush:

 

I can't find this definition anywhere. Neither in any of the two filenames.php (catalog and catalog/admin) nor in the configure.php files and I don't really know where else to look. What exactly are the negative effects of the first solution (other than that it might not be the "proper" way to solve this problem).

 

Thanks a lot for your effort on this!!!!

 

Karin

Link to comment
Share on other sites

Aha I guess I still have to learn a lot about this echo concept. :blush:

 

I can't find this definition anywhere. Neither in any of the two filenames.php (catalog and catalog/admin) nor in the configure.php files and I don't really know where else to look. What exactly are the negative effects of the first solution (other than that it might not be the "proper" way to solve this problem).

 

Thanks a lot for your effort on this!!!!

 

Karin

 

Codewise no real downsides are there... Only downside to this solution is that if you change the location you have to dive into the code again instead of setting it via a configuration option...

 

Your last chance is to check if it is set in the configuration table in your database

 

Grtz,

 

Arjan Gelderblom

I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.

-- Stephen Hawking

Link to comment
Share on other sites

Thank you very very much for your help. I guess I'll leave it the way it is. I'm just happy that it is working and I will make a note somewhere how to change the location in case necessary.

 

:) Karin

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...