Solved

Where does Magento store its logs ?

Posted on 2011-02-22
9
1,577 Views
Last Modified: 2012-05-11
Hello,

I'm experimenting with magento, but i'm running into some noob questions.
I can't find a clear explenation on the web so i figured i might give it a try here :)

When i click the Magento Connectmanager i'm redirected to re-enter my login data.
After entering the data i get this error :

Cannot save: 'C:\inetpub\vhosts\sitename\httpdocs\downloader\..\downloader\cache.cfg'

No furture details are given, i figure its a permission problem.
So as its hosted on a windows environment i can't just chmod the folders.
I went looking for the cache.cfg in the downloader folder but there are 12 cache.cfg files according to my hosts control panel file manager.

So i went looking for log files that might have noted a more details error.
on the web people say it should be in /var/logs/ but i have no such folder.
In magento system > site management > developer error logging is enabled.

i'm using the latest magento build 1.5.x
0
Comment
Question by:Th0R
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 3

Expert Comment

by:wwwdeveloper2
ID: 34957510
Have you tried looking at the source code in your Mage.php file to see where the directory path is set to for logging exceptions?  That should tell you where your logging is taking place.  You probably can even change that path to a new location of your choosing. You will just need to make sure the directory where it is saving the log files is writable, or your logs probably won't be created.

Hopefully this will help.
0
 
LVL 12

Expert Comment

by:miked2004
ID: 34961220
if you have logging enabled as you say then the logs will appear in /var/log/. The var folder must be writable by the server inorder to create this file. Try creating the log folder and see if the logs populate then. There is also a /var/report folder that contains exception logs.

The quickest way to get past this would be to give the webserver write permission to the entire webroot then download what you need from magento connect, then restore the old file/directory permissions.


Just a Note: Magento was developed and tested on unix/linux. There have been many issues running it on a windows server.
0
 
LVL 12

Expert Comment

by:miked2004
ID: 34961230
P.S. These folders should be writable by the server

/app/etc
/var
/media
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 3

Expert Comment

by:wwwdeveloper2
ID: 34963517
mike he says he doesn't have that folder:

"So i went looking for log files that might have noted a more details error.
on the web people say it should be in /var/logs/ but i have no such folder."


That is why I suggested he change the file path a folder he has and make sure that is writable.
0
 
LVL 12

Expert Comment

by:miked2004
ID: 34963805
This folder is created by magento, and the folder is log not logs. So as long as he follows the install directions, which include making the /var folder writable then this folder will be created when any logs are created. this seems much easier that trying to hunt through code and change something that already works.
0
 

Author Comment

by:Th0R
ID: 34966405
okay,

I went looking in the mage.php file for any log
The only log i'm able to find is in the snippet.
I tried to find any of the folders noted in there but with no luck.

I see that the mage.php has several entries to a chmod 0777, i wonder if that can even work because i'm using it on a windows host.

the IUSR has full control over the var folder needed to store the default logs.

I'm going to contact my host and see if he can shine some light on this (me).

Thanks for the quick responses


/**
     * log facility (??)
     *
     * @param string $message
     * @param integer $level
     * @param string $file
     * @param bool $forceLog
     */
    public static function log($message, $level = null, $file = '', $forceLog = false)
    {
        if (!self::getConfig()) {
            return;
        }

        try {
            $logActive = self::getStoreConfig('dev/log/active');
            if (empty($file)) {
                $file = self::getStoreConfig('dev/log/file');
            }
        }
        catch (Exception $e) {
            $logActive = true;
        }

        if (!self::$_isDeveloperMode && !$logActive && !$forceLog) {
            return;
        }

        static $loggers = array();

        $level  = is_null($level) ? Zend_Log::DEBUG : $level;
        $file = empty($file) ? 'system.log' : $file;

        try {
            if (!isset($loggers[$file])) {
                $logFile = self::getBaseDir('var') . DS . 'log' . DS . $file;

                if (!is_dir(self::getBaseDir('var').DS.'log')) {
                    mkdir(self::getBaseDir('var').DS.'log', 0777);
                }

                if (!file_exists($logFile)) {
                    file_put_contents($logFile, '');
                    chmod($logFile, 0777);
                }

                $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
                $formatter = new Zend_Log_Formatter_Simple($format);
                $writerModel = (string)self::getConfig()->getNode('global/log/core/writer_model');
                if (!self::$_app || !$writerModel) {
                    $writer = new Zend_Log_Writer_Stream($logFile);
                }
                else {
                    $writer = new $writerModel($logFile);
                }
                $writer->setFormatter($formatter);
                $loggers[$file] = new Zend_Log($writer);
            }

            if (is_array($message) || is_object($message)) {
                $message = print_r($message, true);
            }

            $loggers[$file]->log($message, $level);
        }
        catch (Exception $e) {
        }
    }

Open in new window

0
 
LVL 12

Accepted Solution

by:
miked2004 earned 250 total points
ID: 34966534
This issue may not be throwing any errors that would be logged. Thus the log folder would not be created yet.
Your main issue is using the downloader and not logging. Obviously your permissions are not set correctly. If there is a module you need to install, just give your web server access to the entire webroot and install what you need, then restore your folder permissions and be done with it. Otherwise you are wasting your time trying to see logs and not solving your original problem.

If you really want to test the logging edit one of the config.xml files in a modules etc folder and remove a > from one of the nodes and that would defanitly throw a logging error.
0
 
LVL 3

Assisted Solution

by:wwwdeveloper2
wwwdeveloper2 earned 250 total points
ID: 34966576
Th0r -  I bet you are onto something with the chmod.  I did some more digging and on the Magento site support, folks are saying you will need mod_rewrite for IIS to get everything up and going during the install.  I have to work under IIS at work, it can definitely be a pain installing apps, since most of them are written with apache and most support is for apache.
0
 

Author Closing Comment

by:Th0R
ID: 34973060
It is a workaround and not a fix, to bad but it works! thnx guys
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question