0

Hello i want to create own log & stored different location like var/supportlog/test.log instead of var/log/test.log. Kindly reply me

5

The log path folder is hard coded in Mage::app().

$logDir  = self::getBaseDir('var') . DS . 'log';
$logFile = $logDir . DS . $file;

And you cannot rewrite the Mage class.

But I think you can put your log in a subfolder of log if you use it like this:

Mage::log('what to log', null, 'support/test.log', true);

This should log your messages in var/log/support/test.log.
Or you can write you own log method in one of your classes that replicates the log method from the Mage class but uses a different folder.
But I wouldn't go that way. Too much work.

1

You can change, for example, var directory in local.xml if you look at config.xml:

<?xml version="1.0"?>
...
<config>
    <global>
       ...
    </global>
    <default>
        <system>
            <filesystem>
                <base>{{root_dir}}</base>
                <app>{{root_dir}}/app</app>
                <code>{{app_dir}}/code</code>
                <design>{{app_dir}}/design</design>
                <locale>{{app_dir}}/locale</locale>
                <etc>{{app_dir}}/etc</etc>
                <media>{{root_dir}}/media</media>
                <upload>{{root_dir}}/media/upload</upload>
                <skin>{{root_dir}}/skin</skin>
                <var>{{var_dir}}</var>
                <cache>{{var_dir}}/cache</cache>
                <session>{{var_dir}}/session</session>
                <tmp>{{var_dir}}/tmp</tmp>
                <pear>{{var_dir}}/pear</pear>
                <export>{{var_dir}}/export</export>
            </filesystem>
        </system>
...
</config>

You able to change all described categories.

Try to add following in node of local.xml

        <system>
            <filesystem>
                <var>{{var_dir}}</var>
                <cache>{{var_dir}}/cache</cache>
                <session>{{var_dir}}/session</session>
                <tmp>{{var_dir}}/tmp</tmp>
                <pear>{{var_dir}}/pear</pear>
                <export>{{var_dir}}/export</export>
            </filesystem>
        </system>

and change here all needed paths.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.