• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1635
  • Last Modified:

Where does Magento store its logs ?

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
Th0R
Asked:
Th0R
  • 4
  • 3
  • 2
2 Solutions
 
wwwdeveloper2Commented:
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
 
miked2004Commented:
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
 
miked2004Commented:
P.S. These folders should be writable by the server

/app/etc
/var
/media
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
wwwdeveloper2Commented:
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
 
miked2004Commented:
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
 
Th0RAuthor Commented:
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
 
miked2004Commented:
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
 
wwwdeveloper2Commented:
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
 
Th0RAuthor Commented:
It is a workaround and not a fix, to bad but it works! thnx guys
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now