Geek Projects – Linux, Apache, MySQL, PHP, DNS A Linux Sysadmin

September 4, 2015

Automatically Rotate Rail’s Development Log (development.log)

Filed under: Rails,Web Development — Matt @ 7:52 pm

By default, Ruby on Rails writes to the same development log, located at log/development.log indefinitely. This can lead to a large log file. Fortunately, it’s possible to rotate this log file without having to depend on any external applications, like syslog. Here’s how:

  1. Add the following to your config/environments/development.rb file. Feel free to replace “daily” with your preferred interval, like “weekly”, or “monthly”:

    config.logger = Logger.new("log/#{Rails.env}.log", "daily")

  2. Restart Rails:

    touch tmp/restart.txt

That’s it! While you’re at it, you’ll probably also want to rotate your test.log file. You can do so by editing config/environments/test.rb, and applying the same update that’s shown above for config/environments/development.rb.

August 28, 2009

Allowing @ Signs in MediaWiki User Names

Filed under: Web Development — Matt @ 1:56 pm

If you attempt to create a new MediaWiki account with its user name set to the same as the email address, you’ll be greeted by a cryptic “You have not specified a valid user name” error message. The reason for this is that MediaWiki forbids the @ sign in user names by default. Fortunately, the fix is easy, but took some Googling to find buried in MediaWiki’s 1.15 Release Notes.

To fix this, open your MediaWiki’s LocalSettings.php file, and add the following lines:

# enable user names with an @ sign
$wgInvalidUsernameCharacters = "";

Note that having an @ sign within a MediaWiki account’s user name can cause issues with InterWiki User Rights, but this shouldn’t be an issue for most MediaWiki installs.

August 16, 2009

Changing Mosets Tree’s Root Directory Page Title

Filed under: Web Development — Matt @ 10:31 pm

About half of the LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack websites that I develop or sysadmin for use the Joomla CMS. I like Joomla because it has a number of excellent extensions, including Mosets Tree – my favorite web directory software. A problem that I ran into recently while installing their latest 2.1 release was that by default, the root directory’s page is givenĀ  a page title of “Directory” with no way to be updated within Joomla. Here’s how I updated the title to something more search engine optimization friendly.

  1. Open up the language/en-GB/en-GB.com_mtree.ini file with your favorite text editor.
  2. Update the following line with your title of choice:

ROOT=Directory

Powered by WordPress