Solved

Where does Magento store its logs ?

Posted on 2011-02-22
9
1,552 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
  • 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

E-commerce is quite a gambling world, and you should never entrust your business to a lucky chance. In order to outrun your competitors in a race to attract as many customers as possible, you need to have a well thought-out strategy under your belt.…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now