13

I was wondering: Can I manually delete the system.log file in the var/log directory in the back end?

If I do this, will it have any negative effects on my web shop?

This file is using quite some disk space now.

1
  • You can delete the system.log file without any repercussions because as soon as there is a warning/error to log, the system will just recreate the file again. You'd have to disable logging altogether in order for this file not to be recreated.
    – zigojacko
    Jan 23, 2015 at 9:46

3 Answers 3

7

Yes, you can delete it, and this action should not affect your webshop in most cases.

If you are not interested in collecting log data, you can disable it in Magento settings: System→Configuration, and go to the «Developer» section, and open Log Settings — there will be an option to disable logging.

But, if Magento generates many log data, it can be a symptom of some problems in code.

1
  • 2
    If your system.log file is constantly growing, it means that the people that worked on the code for the site have done some things that are not quite proper. Usually it involves variables not being set properly or other inconsistencies in the code. Best practice is to keep on top of this file, especially after installing modules, so that you aren't piling up all this stuff that you're going to want fixed later.
    – pspahn
    Jan 22, 2015 at 21:46
4

It can be a possible problem, if the webserver has the right to write this file, but not to create a new file. Its uncommon, because magento creates a lot of files over time, but a not impossible edge case.

1
  • 1
    In layman's terms - you can delete the system.log file however the web server might not have rights to the var/log folder (even if it had rights to the system.log file in that folder). Therefore the system.log file might not re-appear if you delete it and the file permissions to the var/log folder are wrong. Jan 22, 2015 at 17:35
2

It is probably best to rotate it instead of deleting it. You didn't mention what type of server you were running, but in the Linux world there is a logrotate daemon that will clean things up for you and archive old data automatically based on time or file size. Rotation as a practice is usually preferred to just deletion since deletion can have some ill side effects, as mentioned in other answers.

General info on log rotation: http://en.wikipedia.org/wiki/Log_rotation

Arch Linux has some specific docs: https://wiki.archlinux.org/index.php/logrotate

Some examples are most likely already available on your system in /etc/logrotate.d/ if you're in a Linux environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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